Repository navigation
fix: send a named User-Agent when checking documentation URLs - #355
Conversation
test_documentation_urls_accessible reported a WORKING page as broken. The openneuropet PetSurfer entry points at surfer.nmr.mgh.harvard.edu, a third-party FreeSurfer host, which answers 403 to requests' default python-requests/2.32.5 and 200 to a browser UA. Measured both ways, plus curl with the same UA string getting 200, so the block is on what requests sends as a whole rather than the string alone. Nothing was wrong with openneuropet's docs, and nothing for its maintainers to fix: the page serves fine to a human. The checker was the problem. It now sends a named UA identifying the project, which is also the polite thing to do when hitting someone else's server on a schedule, and falls back to GET when HEAD comes back 403 or 405. Some hosts and CDNs refuse HEAD while serving the same URL happily over GET, and the question here is whether the page exists, not whether the host implements HEAD. Verified: openneuropet now passes, and so do bids, eeglab, hed, mne, openneuropet, and the rest. nemar still fails on this branch for an unrelated reason -- the /dataset URL I introduced in #352 -- which #354 fixes.
2a17df2 to
88705bb
Compare
|
Hi @neuromechanist, I can pass this along to our networking team to have a look. I just want to confirm that this is the minimal test that reproduces the issue? Returns a 403 |
|
Hi again @neuromechanist, The response I got from our network admin is:
Are you able to pass along the IP address or range the requests came from? We might be able to look into this further and perhaps make some exceptions. You can sent it to me privately at pwighton @ mgh.harvard.edu if you don't want to post it here. |
|
I am the network admin. I have adjusted numbers that were definitely too aggressive. Try again now. |
|
Thanks @paulraines68! |
|
Thanks @paulraines68 and @pwighton, the 403s stopped after the rate-limit change. A separate report, in case it helps: as of 2026-09-29 18:39 PDT, |
The file had sections for 0.8.10, 0.8.12, 0.8.14 and 0.8.15 only. The three missing releases are written from the pull requests between their tags (0.8.13: #438, #440, #441, #443; 0.8.11: #418; 0.8.9: #351 to #355 and #359 and #367), so the last seven releases are now all present. Tested: docs only; each entry checked against its pull request's body.
test_documentation_urls_accessible[openneuropet]was reporting a working pageas broken, and the openneuropet docs were never the problem.
What is actually happening
The PetSurfer entry points at
surfer.nmr.mgh.harvard.edu/fswiki/PetSurfer--FreeSurfer's wiki, a third-party host. Measured three ways:
requests.head, default UA (python-requests/2.32.5)requests.head, browser UAcurl -I, fakingpython-requests/2.32.3So something in what
requestssends as a whole is being refused, not the UAstring on its own. Either way the page serves fine to a human, so there is nothing
for @CPernet, @martinnorgaard or @mathesong to fix on their side -- flagging them
only because it was their community's test showing red.
The fix
Send a named User-Agent identifying the project. That is also the polite thing
to do when hitting someone else's server on a schedule, rather than arriving as an
anonymous library default.
And fall back to GET when HEAD returns 403 or 405. Some hosts and CDNs refuse
HEAD outright or treat it as suspicious while serving the same URL happily over
GET, and the question this test asks is whether the page exists -- not whether the
host implements HEAD.
Verification
pytest -m network -k documentation_urls_accessible: openneuropet now passes,along with every other community.
nemarstill fails on this branch, for an unrelated reason: the/datasetURL Iintroduced in #352, which #354 fixes. The two are independent and both are
needed.