-
Couldn't load subscription status.
- Fork 21
Feature/expose rate limit headers #55
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
Feature/expose rate limit headers #55
Conversation
|
This is great, and I thank you for the effort. That said, I think this is a great opportunity for us to work towards something more type safe and class based. I'd suggest putting most of the rate limit stuff into it's own class, say
That could all then mean that those lose the Then anyone using the client can do something like |
|
I'll take a shot at it. BTW, what version of python does this project use? |
|
Good luck, let me know if you have any issues on the way - I'm jasondilworth on Discord if you want to bounce stuff around. Python version wise I use it in projects 3.10-3.12 at the moment but that's yet another thing I'd like to do at some point - get a Tox setup here to test lots of environments automatically. |
|
setup.py shows 3.6, but since 3.9 is about to go end-of-life, I will make the new class compatible with 3.10+. My personal project is on 3.12 (which is where I started using Python), so if you catch anything not compatible just let me know. |
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
2f97a56 to
d14e76b
Compare
|
I moved everything into a class. The single tests.py was getting very large, so in the interest of organization, I also moved the class tests into their own test module and moved all the tests into a /tests folder. I hope that was ok. |
|
That's looking real good – I almost pointed out a couple of picky things but this isn't work! We're very much on the same page tests wise, I've got a draft PR for doing more wide ranging type safety that does very similar: #57, I'll sort that based on your changes at some point. |
This PR exposes the rate limit response headers so end users can plan a strategy to try to avoid being rate limited. It adds a class property that is updated on each call to the /data API, along with several getter methods to retrieve the information. There are no changes to any of the existing public methods and this should be completely backwards compatible.
Closes #54.