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
"too many requests by the client" when executing two XML-RPC methods in a row #8753
Comments
@di I don't think that adding a sleep to the example is the right thing to fix this.
One such consumer is https://github.com/fedora-python/pyp2rpm |
The message is technically correct (in reality it's a fraction of a second that is being rounded down) but I'll agree it's confusing. I've made #8757 to address this.
For the purposes of the original issue (the documentation example), it is sufficient. For clients consuming this API, they will need to support adhering to the ratelimit. We're not planning on relaxing or changing this ratelimit in the future. |
While I still think that 1request/second is a way too harsh limit to make the API really usable, I came up with the following to make my life a tad easier in regard to adhering to the limit: import time
import xmlrpc.client
class RateLimitedServerProxy(xmlrpc.client.ServerProxy):
def __getattr__(self, name):
time.sleep(1)
return super(RateLimitedServerProxy, self).__getattr__(name)
client = RateLimitedServerProxy('https://pypi.org/pypi') Feel free to add that to the examples. |
pypi.org has rate-limited their XML-RPC API to 1 request/second, see pypi/warehouse#8753 for details. Let's adhere to that limit until we migrate to the new JSON API.
pypi.org has rate-limited their XML-RPC API to 1 request/second, see pypi/warehouse#8753 for details. Let's adhere to that limit until we migrate to the new JSON API.
pypi.org has rate-limited their XML-RPC API to 1 request/second, see pypi/warehouse#8753 for details. Let's adhere to that limit until we migrate to the new JSON API.
pyp2rpm is affected by this, and I can add sleep to my own code to address the rate limit, but there's another problem. pyp2rpm calls virtualenv (which calls pip), which appears to also use the XMLRPC interface with a simple retry on failure. Often, this appears to create a loop that never exits, though some of the time it does work and some of the time it does fail. Since all of this is happening in an external process, I don't have much control over it. I'm not getting any of the output from the python 2 pip process, so I suppose it's possible that isn't rate-limit related, but that seems like the most likely explanation. At this point, I don't see any solution other than removing all support for Python 2. |
Which version of virtualenv+pip is this, and what pip/virtualenv command are you running? |
Python 2.7, virtualenv 20.0.25, pip 20.1.1
|
I also don't think the rate limiting at PyPI is working correctly. I've updated pyp2rpm to sleep 2 seconds after a failed request, and I still see repeated failures. On Fault, the application logs the error, then sleeps 2 seconds, then retries:
|
Now I see...
The documented requirement of sleeping one second is not adequate to deal with the actual rate limit. Furthermore, the documentation states:
... but I've looked at the list archives for the last few months, and I don't see any notices regarding this stage of the deprecation. Would you consider removing the rate limit until its actual behavior has been announced, and the documentation describes how to adjust legacy clients while they're ported to the JSON API? |
I have just been hit by this. I'm fine with the idea that people should move to another API, but what is the replacement for the mirroring API ( |
Also, there have been absolutely no messages about this on pypi-announce, and the "RSS API" mentioned has no documentation, and the JSON API has no equivalents for the parts of the XMLRPC API that are important for those of us trying to incrementally maintain an offline mirror of bulk PyPI data. (By "incrementally" I hope it's clear that I mean "in a server-friendly manner" 🙁) |
Thanks @evgeni, I had the same problem because I request a status of my project before releasing, and your workaround helped me. Summary of my release script:
|
Describe the bug
The warehouse XML-RPC documentation has a nice example how to obtain information about a package:
However, due to recent rate-limiting changes, the example doesn't work anymore and only raises:
Expected behavior
Example from the documentation (or any other XML-RPC based client) works.
To Reproduce
Paste the above into Python3:
My Platform
Python 3.8 on Fedora 32, but that shouldn't matter, really.
Additional context
The text was updated successfully, but these errors were encountered: