Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support asynchronous requests (accept aiohttp.ClientSession in berserk.Client?) #18

Open
jacksonthall22 opened this issue May 26, 2023 · 2 comments

Comments

@jacksonthall22
Copy link

I'm writing a discord bot in PyCord, where the docs suggest performing all requests asynchronously. To be able to use berserk for my bot I would love if something like this worked out of the box:

async with aiohttp.ClientSession() as session:
    client = berserk.Client(session=session)
    ...  # Make api calls etc.
@icp1994
Copy link
Contributor

icp1994 commented May 27, 2023

https://lichess.org/api#section/Introduction/Rate-limiting mentions: "Only make one request at a time."

@benediktwerner
Copy link
Member

Yeah, there probably are not a lot of cases where async is really beneficial when using the Lichess API. Though it might still be useful to handle timeouts and stuff like that nicer or when already using async for other things.

It looks like it should theoretically be possible to transparently use an async client but getting streams and types to work properly might be a bit tricky. But if anybody can find a nice solution, I'd be open to merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants