-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Requests 403 Client Error #11763
Comments
It seems it's getting 403 when trying to download https://raw.githubusercontent.com/bjlittle/geovista-data/2024.10.2/assets/natural_earth/physical/ne_coastlines_10m.vtk.bz2. However, I'm able to download that file without issues. I'd say it was a temporary error on the GitHub side. This doesn't seems related to Read the Docs. |
Thanks @humitos for getting back so quickly 💯 I'm able to successfully How are you replicating this issue on your side? And what are you getting? 403 also? |
Just clicking on that link, it works and download the file. |
Okay, I think this is a rate limiting related issue on the GH server side when pulling assets from GH to RTD. I'm just going to close this issue, thanks again @humitos 🍻 |
This is a persisting issue and is affecting more packages which build docs on rtd an use pooch to retrieve assets. It's hard to debug if this only happens on rtd and not locally or in other setups. What I can tell, it already fails on the first fetch of an asset, so I doubt the rate limiting theory. Here are two more links to very recent issues:
@humitos How would we get to the bottom of this? Do you see a way to debug this from your side. I was assuming some other dependency issue but did not spot any recent changes so far. One problem for debugging from user side is the missing mamba environment listing (can we activate that somehow?). |
@kmuehlbauer I don't have a different way to debug this from my side. I would recommend you first to create a minimal reproducible example that generates the issue --outside the environment of your project.
What is "mamba environment list"? If I understand correctly you refer to the list of packages installed in the environment. If that's correct, you can run |
Thanks @humitos, that's helpful. Would you mind opening the issue again, until the root cause is found? |
@humitos I've distilled the issue to just use https://github.com/readthedocs/tutorial-template and Pull Requesthttps://github.com/kmuehlbauer/pooch_rtd_issue/pulls Build logshttps://app.readthedocs.org/projects/pooch-rtd-issue/builds/26278637/ Codeoutput_file = open("output_file.nc", "w+b")
url = "https://github.com/readthedocs/readthedocs.org/raw/refs/heads/main/docs/dev/code-of-conduct.rst"
print("downloading: ", url)
try:
response = requests.get(url, timeout=30, allow_redirects=True)
response.raise_for_status()
output_file.write(response.content)
finally:
output_file.close() Something is broken between RTD and GitHub and this is as far as I can get. I'd appreciate of you could sort this out with GitHub, as this seems to be a problem of RTD builds. Thanks! |
Hrm, I just tried to reproduce this on our build servers with a shell, and I got a 200:
So it isn't something that's totally broken 🤔 |
It looks like other folks have been having a similar issue: https://stackoverflow.com/questions/39907742/github-api-is-responding-with-a-403-when-using-requests-request-function Is it related to this perhaps? |
I'm wondering if this was a temporary networking issue or something, since I can't seem to reproduce it on our build servers at all. Curious if you rebuild your test repo if it still fails? |
Hrm, I was able to reproduce it in the build... https://app.readthedocs.org/projects/eric-pooch-rtd-issue/builds/26282150/ |
I updated it to print out the error: https://app.readthedocs.org/projects/eric-pooch-rtd-issue/builds/26282177/
I guess we need to contact GitHub support 🙃 |
👋 I ran into the same problem over in the Dask docs (xref dask/dask#11522). Stack overflow suggested setting a custom Though fixing things on the GitHub side would be much more convenient : ) |
Yea, looks like the issue is the lack of a user agent. When I updated the example to pass a user agent, it works: https://app.readthedocs.org/projects/eric-pooch-rtd-issue/builds/26282216/ Guessing this is GH getting hammered by AI bots, and restricting requests without agents, like the rest of us. |
Thanks @ericholscher for testing it and @jrbourbeau for the solution. It's a pity that RTD and GitHub have to take these countermeasures, but totally reasonable and understandable. Thanks a bunch ❤️ |
@ericholscher Would it make sense to come up with a solution to provide some auth token to the request? At least for those builds which have been triggered/authorized with GitHub this might be possible for requests which reach out to GitHub resources. Any thoughts? |
For pooch the you have to define a downloader = pooch.HTTPDownloader(headers={"User-Agent": "agent"})
return REMOTE_RESSOURCE.fetch(name, downloader=downloader) |
hub is requireing a custom user now to prevent getting spammed. see readthedocs/readthedocs.org#11763
<!-- Please ensure the PR fulfills the following requirements! --> <!-- If this is your first PR, make sure to add your details to the AUTHORS.rst! --> ### Pull Request Checklist: - [x] This PR addresses an already opened issue (for bug fixes / features) - This PR fixes #xyz - [x] (If applicable) Documentation has been added / updated (for bug fixes / features). - [x] (If applicable) Tests have been added. - [x] CHANGELOG.rst has been updated (with summary of main changes). - [x] Link to issue (:issue:`number`) and pull request (:pull:`number`) has been added. ### What kind of change does this PR introduce? * Fixes an issue related to `pooch` in recent ReadTheDocs builds. ### Other information: - See readthedocs/readthedocs.org#11763
### What kind of change does this PR introduce? * Overloads the `fetch()` method of `nimbus()` to add a `UserAgent`, thus preventing requests from ReadTheDocs from being forbidden by GitHub. * Fixes up the logic for fetching the `registry.txt` files and testing data from non-`Ouranosinc/xclim-testdata` repositories that follow the same conventions (forks, `xhydro-testdata`, etc.). ### Does this PR introduce a breaking change? Not really. The `fetch` calls have been modified and the registry files for non-`Ouranosinc/xclim-testdata` files are now saved to the testing folder with the following convention: `registry.{repo-name}.{branch-name}.txt`. ### Other information: readthedocs/readthedocs.org#11763
### What kind of change does this PR introduce? * Adds a user-agent to the pooch call in order to deal with forbidden remote requests * Fixes the URL joining logic in `load_registry` and `deveraux` * Removes an unused import in `conftest.py` ### Does this PR introduce a breaking change? No. ### Other information: readthedocs/readthedocs.org#11763
I think that something changed recently that is causing this failure. My RTD_TOKEN was not updated/reset in 7 months, but is now failing with 400 error. https://github.com/ansible/ansible-lint/actions/runs/12146553571/job/33870743030#step:6:52
Also filed at nextstrain/readthedocs-cli#8 |
@ssbarnea That is a different issue, so you should open a new issue with it. If you can share an example request, along with the data passed in, that would be really helpful in debugging it on our side. |
@ssbarnea This might be closer to this issue: However, I believe if it is you would get a 403 not a 400 response. |
Yea, I looked at the logs and the 400 is coming from the origin, which would be our application. So it's likely that something changed in the validation logic there or something. I'm guessing there might have been a new required field added or something, but I don't remember anything obvious that we've changed recently. |
Hi. We also have been tripped by this problem, running a particular job that talks to the RTD HTTP API from a Python EOL environment using ancient dependencies. Fortunately, considering those information bits and blueprints (thanks a stack, @tsibley and @joverlee521!),
we have been able to likewise update versions of the |
Details
Expected Result
We've successfully been using pooch to download various external assets required to build the sphinx-gallery of our documentation.
However, we're now getting a
403 Client Error
. Has there been a very recent RTD server-side change that may be causing this?Actual Result
For further details see https://readthedocs.org/projects/geovista/builds/26264004/
The text was updated successfully, but these errors were encountered: