Open eve-alt opened 4 years ago
@eve-alt. feel free to implement it. What would be the benefit of having an async wrapper? That you could include in async Python projects?
I'm not really familiar with async in Python. It seems it was invented to speed up an application and to not have blocking threads, am I right?
Anyway, once your done, we can reference your wrapper in our readme/website. Or if you want we can include it under the PokeAPI org.
That sounds wonderful eve-alt! Will you be submitting this as an update to pokebase (so that users who want a python wrapper can download pokebase and then choose if they want synchronous/asynchronous operation), or will this be a separate module (like pokebase-async or whatever you want to name it)?
hi, i think you misunderstood what i said, i just referenced another command made by someone else as i was asking if he already released it since a year has passed already.
Oh, Now I get it! I'll format your issue properly.
To answer your question: no nothing has been released. But feel free to do it, if you got inspired by our excitement 😸
I decided to try and practice some python and attempt to make the async wrapper. I made a branch in my fork here.
I didn't change any original code, so you can still use it as synchronous code, and instead made the functions/classes as async. It seems to work, although I don't know much about python asynchronous testing so I haven't made any tests for it 😅.
You can try it out by starting an event loop and calling the async functions, like so:
loop = asyncio.get_event_loop()
async def main():
charmander = await pb.async_pokemon('charmander')
charmander.height
loop.run_until_complete(main())
I hope one of you can give it a try and let me know what you think 😄.
Not a Python expert also on my side. I'll give it a try if @Kronopt cannot take a look at it :)
I just brushed over the code and it looks good, @C-Garza! I didn't test it though.
I just have one comment: This way you have the requirements for both implementations of pokebase (async and regular) on the same package. That might not be ideal.
To test aiohttp requests you could try aioresponses.
Yeah I quickly realized that I would basically have to keep separate async versions of the code, but kept them in the same files for now. So @Kronopt, would you suggest that async changes be added as a separate module like pokebase-async
like @GregHilmes mentioned above?
I guess I have to learn some async python testing now 😅.
Hi boys, in case you are wondering, we can have a separate project nested in the PokeAPI org. We can use PokeAPI/pokebase-async
or a completely new name PokeAPI/{you decide}
.
I'd opt for a new one.
@C-Garza a separate module would be best yes, in my opinion
Hi! I just wanted to tell that I made an async wrapper for the pokeapi, you can find it here.
Howdy there!
Originally posted by @Tmpod in #7 (comment) Sry for posting on this closed issue but I've been looking for an async fork of this and I haven't found anything. So, since I'm quite experienced with the async framework and I've already done another async API wrapper (for Hypixel), I'd like to do that. I will start working on it as soon as I can and I'll post a message in this thread once it's done/usable. Is that OK?
hi, as I was reading thru issues I saw ur reply and thought that hey, a year already passed and was just thinking if it was released already and I didn't know about it. I also tried googling
pokebase-async
and didn't see anything that I was looking for so, I'd like to ask if the async wrapper will be really a thing.
Hi! Sorry, I ended up not going very far with it because I stopped working on the project that needed the wrapper... I should have posted an update on that issue, apologies :/
Howdy there!
hi, as I was reading thru issues I saw ur reply and thought that hey, a year already passed and was just thinking if it was released already and I didn't know about it. I also tried googling
pokebase-async
and didn't see anything that I was looking for so, I'd like to ask if the async wrapper will be really a thing.