tybug / ossapi

The definitive python wrapper for the osu! api.
https://tybug.github.io/ossapi/
GNU Affero General Public License v3.0
80 stars 17 forks source link

an asynchronous version of the v2 API wrapper #44

Closed bemxio closed 1 year ago

bemxio commented 2 years ago

it would be quite useful for website backends, with logins and discord bots, that also want to authenticate users in a way https://async-oauthlib.readthedocs.io/en/latest/ there's an async oauth module, that seems to fit the features needed for it and for requests themself, aiohttp would be nice it could be named something like AsyncOssapiV2 which would be used the same as the synchronous one, except that all endpoints would need to be awaited

tybug commented 2 years ago

yep, this has been on my mind for a while now. I'll write an async version at some point (or someone is free to beat me to it, as always)

xFGhoul commented 2 years ago

possibly separate them into folders so imports become like sync.OssapiV2 or async.OssapiV2

tybug commented 2 years ago

I'd prefer if the async version was called AsyncOssapiV2 to clearly mark it as async, and the sync version continue to be the default OssapiV2.

I did start working on this, and you can see my (extremely rough and currently erroring) progress on the async branch, namely commit https://github.com/circleguard/ossapi/commit/b420040989fc8b9982989355b0fba71f607335f6.

It turned out to be a pain to extract out the async portions of the code cleanly. The async version of the requests oauthlib is also broken (https://github.com/weibeu/Async-OAuthlib/issues/3) so I would need to either fix that or roll my own implementation.

In short, don't expect this anytime soon.

tybug commented 1 year ago

I've implemented this in v3.1.0. You can import it as OssapiAsync and use it identically to Ossapi. Read more on the docs: https://circleguard.github.io/ossapi/async.html.