File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -302,13 +302,20 @@ def read_text_from_href(self, href: str) -> str:
302302 with urllib3 .request (
303303 "GET" ,
304304 href ,
305- headers = {"User-Agent" : "pystac" , ** self .headers },
305+ headers = {
306+ "User-Agent" : f"pystac/{ pystac .__version__ } " ,
307+ ** self .headers ,
308+ },
306309 preload_content = False , # type: ignore
307310 ) as f :
308311 href_contents = f .read ().decode ("utf-8" )
309312 else :
310313 req = Request (
311- href , headers = {"User-Agent" : "pystac" , ** self .headers }
314+ href ,
315+ headers = {
316+ "User-Agent" : f"pystac/{ pystac .__version__ } " ,
317+ ** self .headers ,
318+ },
312319 )
313320 with urlopen (req ) as f :
314321 href_contents = f .read ().decode ("utf-8" )
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def test_headers_stac_io(request_mock: unittest.mock.MagicMock) -> None:
130130 pystac .Catalog .from_file ("https://example.com/catalog.json" , stac_io = stac_io )
131131
132132 headers = request_mock .call_args [1 ]["headers" ]
133- assert headers == {"User-Agent" : "pystac" , ** stac_io .headers }
133+ assert headers == {"User-Agent" : f "pystac/ { pystac . __version__ } " , ** stac_io .headers }
134134
135135
136136@pytest .mark .vcr ()
You can’t perform that action at this time.
0 commit comments