Skip to content

add warnings for upgrading to 1.0.0-rc.2, handle pystac-exceptions, add auth to requests (partial) #158

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

Merged
merged 2 commits into from
Oct 31, 2022
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - TBD

## Added

- Add support for Authorization Bearer and arbitrary query parameter authentication
- Add warning about upgrading to 1.0.0-rc.2

## Fixed

- Handle pystac-client exceptions #152

## [0.3.0] - 2022-10-25

### Removed
Expand Down
17 changes: 17 additions & 0 deletions COMPLIANCE_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ errors:
- [Item Search - Filter Ext] method=GET url=https://tamn.snapplanet.io/search params={'limit': 1, 'filter-lang': 'cql2-text', 'filter': "collection <> 'S2'"} body=None had unexpected status code 504 instead of 200:
```

### Radiant ML Hub

URL: <https://api.radiant.earth/mlhub/v1>

Date: 31-Oct-2022

Output

```
$ poetry run stac-api-validator --root-url https://api.radiant.earth/mlhub/v1 \
--conformance core --conformance features --conformance item-search \
--auth-query-parameter 'key=xxx' \
--collection lacuna_fund_eotg_v1_labels \
--geometry '{ "type": "Polygon", "coordinates": [ [ [ -6.873149632157182, 13.306361128851238 ], [ -6.8729475
45317309, 13.329493867068924 ], [ -6.8965701520705105, 13.329690854131131 ], [ -6.896769998632048, 13.30655776190765 ], [ -6.873149632157182, 13.306361128851238 ] ] ] }'
```

### Sentinel Hub 1.0.0 Catalog

URL: <https://services.sentinel-hub.com/api/v1/catalog/1.0.0/>
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ Options:
--conformance [core|browseable|item-search|features|collections|children|filter]
The conformance classes to validate.
[required]
--auth-bearer-token TEXT Authorization Bearer token value to append
to all requests.
--auth-query-parameter TEXT Query pararmeter key and value to pass for
authorization, e.g., 'key=xyz'.
--help Show this message and exit.
```

Expand Down Expand Up @@ -154,6 +158,12 @@ errors:
- POST Search with bbox:[100.0, 0.0, 0.0, 105.0, 1.0, 1.0] returned status code 400
```

Example with authorization using parameters:

```
stac-api-validator --root-url https://api.radiant.earth/mlhub/v1 --conformance core --auth-query-parameter 'key=xxx'
```

## Validating OGC API Features - Part 1 compliance

A STAC API that conforms to the "STAC API - Features" conformance class will also be a valid implementation
Expand Down
12 changes: 12 additions & 0 deletions src/stac_api_validator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@
),
help="The conformance classes to validate.",
)
@click.option(
"--auth-bearer-token",
help="Authorization Bearer token value to append to all requests.",
)
@click.option(
"--auth-query-parameter",
help="Query pararmeter key and value to pass for authorization, e.g., 'key=xyz'.",
)
def main(
log_level: str,
root_url: str,
conformance_classes: List[str],
collection: Optional[str],
geometry: Optional[str],
auth_bearer_token: Optional[str] = None,
auth_query_parameter: Optional[str] = None,
) -> int:
"""STAC API Validator."""

Expand All @@ -66,6 +76,8 @@ def main(
conformance_classes=conformance_classes,
collection=collection,
geometry=geometry,
auth_bearer_token=auth_bearer_token,
auth_query_parameter=auth_query_parameter,
)
except Exception as e:
print(f"Failed.\nError {root_url}: {type(e)} {str(e)}")
Expand Down
Loading