Aiohttp intead of requests
Stonedestroyer opened this issue · 5 comments
Any possibility we may get aiohttp instead of requests to support asynchronous calls?
I just looked a little into this, wouldn't it force users of the library to use asyncio in their code? If there's a way to make whether the library uses requests or aiohttp optional, I'll try making a PR for it.
Yes there would probably need to be a setting to choose one with requests being default. I can help with aiohttp bits but I am not sure how to make the actual design how to switch between them.
My idea is that you just rewrite the jikan.py
file asynchronously in a file called jikanasync.py
that has a class called JikanAsync
with all the methods as Jikan
but asynchronously written. Then, it could be constructed like this:
from jikanpy import JikanAsync
jikan = JikanAsync()
Since a lot of the two files would be the same (i.e. all the error checking in the methods), we could move the error checking methods into a file called checks.py
and have both the methods in jikan.py
and jikanasync.py
use those methods to check for client exceptions.
Yes that seems like a good idea. I will not be able to work at this currently.
I'll try working on it, I have some experience with async stuff from using discord.py