-
Notifications
You must be signed in to change notification settings - Fork 122
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
TooManyRedirects with PyPI json API #214
Comments
Doing some cleanup; I think this was caused by a temporary redirect loop on PyPI that was since fixed. Please let me know if I'm wrong and I'll reopen. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been working with a cache of PyPI json records for a while, and have two resources which now causes
TooManyRedirects
because of PyPI package normalisation.One is https://pypi.org/project/django-coverage-plugin/
The JSON is at
https://pypi.org/pypi/django-coverage-plugin/json
However I am occasionally using
django_coverage_plugin
i.e. django_coverage_plugin which redirects to https://pypi.org/pypi/django-coverage-plugin/json , for which I have a cache entry eb708b277cfec19dff1c796663031b09f5fc8ba511d43b56dad8fcc5 created today:
But I also have an older cache entry 17e4bde404ebd1e71cb2a45d038b6c02900991906af7a0956d110822
The other package I encountered this with is an old record for
jupyter-console
redirecting to jupyter_console and a newjupyter_console
entry for a redirect to back tojupyter-console
.Maybe the backend is changing whether it uses the normalised name or the literal name in the json path name, or it depends on the version of the uploader, or maybe it was gamma rays. I havent found any consistency yet.
https://pypi.org/pypi/setuptools_scm/json
redirects_
to-
buthttps://pypi.org/pypi/backports.ssl_match_hostname/json
does not.This is likely to be a problem for pip if it uses the JSON api.
Anyways, as these cycles are occurring between cache entries which are not being refreshed, repeating the loop multiple times is a bit silly (default requests redirect max is 30). Seems like it would be appropriate to detect the cycle early and possibly invalid the cache entries so the server can resolve the problem, or at least re-affirm the problem still exists. This could also be solved by invalidating any redirect cache entry if it is older than any of the redirect cache entries encountered whilst handling the current request.
The text was updated successfully, but these errors were encountered: