-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add a way to respect API rate limits and timeouts #66
Comments
Hello @AntonLydike There is a polite mode in the API. In fact, this API has a synchronous approach so usually it never do lots of requests. One implementation that is attended to increase the API performance is to do requests in parallel using multiprocessing or something like that while iterating into pages. You can review the polite mode. |
I toke a look in the implementation and it seems to be broken, it should be improved for better performance. Take a look at: crossrefapi/crossref/restful.py Line 58 in 53a0c77
|
Basically, what I'm doing is sharing a single It would be cool to have an internal method inside the API to handle this rate limiting even when used in a multi-threaded workload. (no need to do multiprocessing here as pythons multithreading works fine for IO bound workloads like this one). |
According to the api docs, the response may contain the following headers to indicate a request to self-limit request rates:
It would be neat if this API supported a mode to self-limit requests to conform to this, or allow for a way to signal these limits to an underlying user.
Happy to submit a patch, if this is a welcome feature.
Also, please let me know if something like this is already implemented here, then I'm happy to write some documentation!
The text was updated successfully, but these errors were encountered: