Implement a rate-limiting system under the pyaww/utils/ directory, specifically pyaww/utils/ratelimit.py.
The rate-limiting algorithm could be a token bucket; or even better a leaky bucket. It should be usable as a decorator and/or with
the async for ... syntax. Function, where this would be used, would be the pyaww.User.request method, its first argument is always the URL.
The rate limits are 40/min per every endpoint, the exception being consoles whereas it is 120/min. Timeouts last a minute to my knowledge.
The concurrency in this module is utilizing asyncio. Make sure it's safe from race conditions by using asyncio.Lock() (note, it is already defined in the __init__ of the pyaww.User, to get an idea on how to access it, look at the pyaww/utils/cache.py.)
For anyone looking to contribute, please open PRs for the dev branch which is the new version in work. It will be merged with the main branch after all planned features get implemented.
Implement a rate-limiting system under the
pyaww/utils/
directory, specificallypyaww/utils/ratelimit.py
.The rate-limiting algorithm could be a token bucket; or even better a leaky bucket. It should be usable as a decorator and/or with the
async for ...
syntax. Function, where this would be used, would be thepyaww.User.request
method, its first argument is always the URL.The rate limits are 40/min per every endpoint, the exception being consoles whereas it is 120/min. Timeouts last a minute to my knowledge.
The concurrency in this module is utilizing
asyncio
. Make sure it's safe from race conditions by usingasyncio.Lock()
(note, it is already defined in the__init__
of thepyaww.User
, to get an idea on how to access it, look at thepyaww/utils/cache.py
.)For anyone looking to contribute, please open PRs for the
dev
branch which is the new version in work. It will be merged with themain
branch after all planned features get implemented.Please see the contributing manual.