Skip to content

Commit b2d1b85

Browse files
authored
Add patch_url kwarg for signing hrefs and objects (#31)
This seems like potentially a better approach than just signing everything but it would be great to get a second opinion closes #29
1 parent 9094e71 commit b2d1b85

14 files changed

+264360
-24
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646

4747
- name: run tests
4848
id: status
49-
run: pytest -v --cov xpystac --cov-report term-missing .
49+
run: pytest -v --cov xpystac --cov-report term-missing --block-network .

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Read from a reference file:
4747
collection = catalog.get_collection("nasa-nex-gddp-cmip6")
4848
asset = collection.assets["ACCESS-CM2.historical"]
4949

50-
xr.open_dataset(asset)
50+
xr.open_dataset(asset, patch_url=planetary_computer.sign)
5151
```
5252
ref: https://planetarycomputer.microsoft.com/dataset/nasa-nex-gddp-cmip6#Example-Notebook
5353

@@ -58,14 +58,14 @@ Read from a zarr file:
5858
collection = catalog.get_collection("daymet-daily-hi")
5959
asset = collection.assets["zarr-abfs"]
6060

61-
xr.open_dataset(asset)
61+
xr.open_dataset(asset, patch_url=planetary_computer.sign)
6262
```
6363
ref: https://planetarycomputer.microsoft.com/docs/quickstarts/reading-zarr-data/
6464

6565
## Install
6666

6767
```bash
68-
pip install xpystac
68+
pip install git+https://github.com/stac-utils/xpystac
6969
```
7070

7171
## How it works

environment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ dependencies:
2222
# testing
2323
- pytest
2424
- pytest-cov
25+
- pytest-recording

tests/cassettes/test_core/test_to_xarray_reference_file.yaml

Lines changed: 254575 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_core/test_to_xarray_with_drop_variables_raises.yaml

Lines changed: 257 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_core/test_to_xarray_with_pystac_client_search.yaml

Lines changed: 257 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_core/test_to_xarray_with_pystac_client_search_with_patch_url.yaml

Lines changed: 508 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_core/test_to_xarray_zarr.yaml

Lines changed: 4222 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_core/test_to_xarray_zarr_with_open_kwargs_engine.yaml

Lines changed: 4184 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_xarray_plugin/test_xarray_open_dataset_can_guess_for_pystac_client_searchs.yaml

Lines changed: 257 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)