-
Notifications
You must be signed in to change notification settings - Fork 123
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
Adds user-agent to the request, if it doesn't exist in the headers. #1292
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1292 +/- ##
==========================================
+ Coverage 91.12% 91.13% +0.01%
==========================================
Files 51 51
Lines 6994 7002 +8
Branches 1001 1002 +1
==========================================
+ Hits 6373 6381 +8
Misses 444 444
Partials 177 177 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Geosynopsis is this change necessary? Working from current main, it appears as though urllib is sending a user agent already.
Client code:
from pystac.stac_io import DefaultStacIO
stac_io = DefaultStacIO()
stac_io.read_text("http://localhost:7822/catalog.json")
To test:
$ nc -l 7822 & python test_1292.py && fg
[2] 48657
GET /catalog.json HTTP/1.1
Accept-Encoding: identity
Host: localhost:7822
User-Agent: Python-urllib/3.11
Connection: close
-- >8 --
Note the User-Agent: Python-urllib/3.11
in the request.
@gadomski It seems to be the issue with the URL with |
That shouldn't be a pystac issue then -- sounds like the |
Yeah, you're right it shouldn't be pystac issue. I'll close the pr. Either the |
Related Issue(s):
Description:
Some servers block the request without user-agent. This PR adds user-agent to headers if it doesn't already exist (through headers override).
PR Checklist:
pre-commit
hooks pass locallyscripts/test
)