Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
media type value for these types and new media types COPC and VND_PMTILES
([#1554](https://github.com/stac-utils/pystac/pull/1554))

### Changed

- Pass "User-Agent": "pystac/3.13.0" in request headers to work around urllib's default "User-Agent" being blocked by readthedocs ([#1576](https://github.com/stac-utils/pystac/pull/1576))


### Fixed

- More permissive collection extent deserialization ([#1559](https://github.com/stac-utils/pystac/pull/1559))
Expand Down
17 changes: 15 additions & 2 deletions pystac/stac_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,21 @@ def read_text_from_href(self, href: str) -> str:
with urllib3.request(
"GET",
href,
headers=self.headers,
headers={
"User-Agent": f"pystac/{pystac.__version__}",
**self.headers,
},
preload_content=False, # type: ignore
) as f:
href_contents = f.read().decode("utf-8")
else:
req = Request(href, headers=self.headers)
req = Request(
href,
headers={
"User-Agent": f"pystac/{pystac.__version__}",
**self.headers,
},
)
with urlopen(req) as f:
href_contents = f.read().decode("utf-8")

Expand Down Expand Up @@ -448,6 +457,10 @@ def read_text_from_href(self, href: str) -> str:
response = http.request(
"GET",
href,
headers={
"User-Agent": f"pystac/{pystac.__version__}",
**self.headers,
},
retries=self.retry, # type: ignore
)
return cast(str, response.data.decode("utf-8"))
Expand Down
96 changes: 40 additions & 56 deletions tests/cassettes/test_catalog/TestCatalog.test_read_remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ interactions:
- request:
body: null
headers:
Connection:
- close
Host:
- raw.githubusercontent.com
User-Agent:
- Python-urllib/3.12
- pystac/1.13.0
method: GET
uri: https://raw.githubusercontent.com/stac-extensions/label/main/examples/multidataset/catalog.json
response:
Expand All @@ -27,7 +23,7 @@ interactions:
Cache-Control:
- max-age=300
Connection:
- close
- keep-alive
Content-Length:
- '436'
Content-Security-Policy:
Expand All @@ -37,35 +33,35 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Thu, 23 Jan 2025 15:04:18 GMT
- Thu, 11 Sep 2025 15:51:20 GMT
ETag:
- '"e74ebcbc46d43c5b693ecb995381fbeba03583627e6d65b21ed7678a10d94729"'
Expires:
- Thu, 23 Jan 2025 15:09:18 GMT
- Thu, 11 Sep 2025 15:56:20 GMT
Source-Age:
- '0'
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization,Accept-Encoding,Origin
- Authorization,Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- f039e0965880c3a4f071ce585f60acb588f5f11c
- b529d376c653063dbe51649d16b4513f9b18c8ca
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- 4495:22F95D:205FB0:23AFE6:67925A71
- 159F:3ACAF2:F8CE77:1374D7D:68C2EE9E
X-Served-By:
- cache-den-kden1300041-DEN
- cache-bos4650-BOS
X-Timer:
- S1737644658.294291,VS0,VE340
- S1757605881.609397,VS0,VE34
X-XSS-Protection:
- 1; mode=block
status:
Expand All @@ -74,12 +70,8 @@ interactions:
- request:
body: null
headers:
Connection:
- close
Host:
- raw.githubusercontent.com
User-Agent:
- Python-urllib/3.12
- pystac/1.13.0
method: GET
uri: https://raw.githubusercontent.com/stac-extensions/label/main/examples/multidataset/zanzibar/collection.json
response:
Expand Down Expand Up @@ -117,7 +109,7 @@ interactions:
Cache-Control:
- max-age=300
Connection:
- close
- keep-alive
Content-Length:
- '1709'
Content-Security-Policy:
Expand All @@ -127,35 +119,35 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Thu, 23 Jan 2025 15:04:18 GMT
- Thu, 11 Sep 2025 15:51:20 GMT
ETag:
- '"ddd340bc27c120dd2e43868bcde0510a326a6223dac1b0c47c05100e20d1397e"'
Expires:
- Thu, 23 Jan 2025 15:09:18 GMT
- Thu, 11 Sep 2025 15:56:20 GMT
Source-Age:
- '0'
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization,Accept-Encoding,Origin
- Authorization,Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- e84c45e0397a83b17c87b325715b916f5d64468d
- 3b49c3a05484403c226cd6bf3f5c47020c8fa603
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- FE9B:2B18D8:1FA6D6:22F4DA:67925A70
- E9A4:25E917:F65002:134CF27:68C2EE9F
X-Served-By:
- cache-den-kden1300070-DEN
- cache-bos4660-BOS
X-Timer:
- S1737644659.655386,VS0,VE202
- S1757605881.744502,VS0,VE44
X-XSS-Protection:
- 1; mode=block
status:
Expand All @@ -164,12 +156,8 @@ interactions:
- request:
body: null
headers:
Connection:
- close
Host:
- raw.githubusercontent.com
User-Agent:
- Python-urllib/3.12
- pystac/1.13.0
method: GET
uri: https://raw.githubusercontent.com/stac-extensions/label/main/examples/multidataset/zanzibar/znz001.json
response:
Expand Down Expand Up @@ -217,7 +205,7 @@ interactions:
Cache-Control:
- max-age=300
Connection:
- close
- keep-alive
Content-Length:
- '2776'
Content-Security-Policy:
Expand All @@ -227,35 +215,35 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Thu, 23 Jan 2025 15:04:19 GMT
- Thu, 11 Sep 2025 15:51:20 GMT
ETag:
- '"80ec96bc0acf2e604a03f109bd730426aa82e442d44946231cbe82a531b944f7"'
Expires:
- Thu, 23 Jan 2025 15:09:19 GMT
- Thu, 11 Sep 2025 15:56:20 GMT
Source-Age:
- '0'
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization,Accept-Encoding,Origin
- Authorization,Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- ed03994fba3b95f37322480c8fd73cae1db4b104
- f022c197150d57ef5d41874f68c5bf2739937624
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- 45D8:173A05:25B586:2904B8:67925A71
- A679:3ACAF2:F8CEAC:1374DBE:68C2EE9F
X-Served-By:
- cache-den-kden1300045-DEN
- cache-bos4624-BOS
X-Timer:
- S1737644659.878747,VS0,VE149
- S1757605881.859959,VS0,VE68
X-XSS-Protection:
- 1; mode=block
status:
Expand All @@ -264,12 +252,8 @@ interactions:
- request:
body: null
headers:
Connection:
- close
Host:
- raw.githubusercontent.com
User-Agent:
- Python-urllib/3.12
- pystac/1.13.0
method: GET
uri: https://raw.githubusercontent.com/stac-extensions/label/main/examples/multidataset/zanzibar/znz029.json
response:
Expand Down Expand Up @@ -317,7 +301,7 @@ interactions:
Cache-Control:
- max-age=300
Connection:
- close
- keep-alive
Content-Length:
- '2774'
Content-Security-Policy:
Expand All @@ -327,35 +311,35 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Thu, 23 Jan 2025 15:04:19 GMT
- Thu, 11 Sep 2025 15:51:21 GMT
ETag:
- '"726870312c74ead0b10c3125045c301e8600929684c49447d64c2db72dc779fc"'
Expires:
- Thu, 23 Jan 2025 15:09:19 GMT
- Thu, 11 Sep 2025 15:56:21 GMT
Source-Age:
- '0'
Strict-Transport-Security:
- max-age=31536000
Vary:
- Authorization,Accept-Encoding,Origin
- Authorization,Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- 46f5162223936806654b1d3c67dbe991947e2158
- 3fdd9d041aa32f44206789e13a539495a5b9eecb
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- 5188:121744:23621E:26B43C:67925A70
- 2E1B:3B0BD:FEBD0E:13D3C78:68C2EEA1
X-Served-By:
- cache-den-kden1300063-DEN
- cache-bos4639-BOS
X-Timer:
- S1737644659.050995,VS0,VE130
- S1757605881.995906,VS0,VE46
X-XSS-Protection:
- 1; mode=block
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ interactions:
- request:
body: null
headers:
Connection:
- close
Host:
- stac-extensions.github.io
User-Agent:
- Python-urllib/3.12
- pystac/1.13.0
method: GET
uri: https://stac-extensions.github.io/label/v1.0.1/schema.json
response:
Expand Down Expand Up @@ -110,17 +106,17 @@ interactions:
Access-Control-Allow-Origin:
- '*'
Age:
- '0'
- '343'
Cache-Control:
- max-age=600
Connection:
- close
- keep-alive
Content-Length:
- '6847'
Content-Type:
- application/json; charset=utf-8
Date:
- Thu, 23 Jan 2025 15:04:19 GMT
- Thu, 11 Sep 2025 15:51:21 GMT
ETag:
- '"61eb1dc9-1abf"'
Last-Modified:
Expand All @@ -134,21 +130,19 @@ interactions:
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
- '2'
X-Fastly-Request-ID:
- 7f59783378f4a0da3ffe78cc03723e72fa363000
- e0d61e319033d4fab6702fca038f5074c34cf44e
X-GitHub-Request-Id:
- 4D47:168048:F2615B:1102B6A:67925A72
- FE08:128B70:CBB40B:E7523E:68C2EEA2
X-Served-By:
- cache-den-kden1300038-DEN
- cache-bos4620-BOS
X-Timer:
- S1737644660.657692,VS0,VE83
- S1757605882.984425,VS0,VE0
expires:
- Thu, 23 Jan 2025 15:14:19 GMT
permissions-policy:
- interest-cohort=()
- Thu, 11 Sep 2025 15:55:38 GMT
x-proxy-cache:
- MISS
status:
Expand Down
Loading
Loading