Skip to content

Commit da39981

Browse files
authored
Merge pull request #158 from stac-utils/pv/2022-10-31
add warnings for upgrading to 1.0.0-rc.2, handle pystac-exceptions, add auth to requests (partial)
2 parents a87bba6 + 579da9a commit da39981

File tree

6 files changed

+232
-121
lines changed

6 files changed

+232
-121
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased] - TBD
9+
10+
## Added
11+
12+
- Add support for Authorization Bearer and arbitrary query parameter authentication
13+
- Add warning about upgrading to 1.0.0-rc.2
14+
15+
## Fixed
16+
17+
- Handle pystac-client exceptions #152
18+
819
## [0.3.0] - 2022-10-25
920

1021
### Removed

COMPLIANCE_REPORT.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,23 @@ errors:
221221
- [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:
222222
```
223223

224+
### Radiant ML Hub
225+
226+
URL: <https://api.radiant.earth/mlhub/v1>
227+
228+
Date: 31-Oct-2022
229+
230+
Output
231+
232+
```
233+
$ poetry run stac-api-validator --root-url https://api.radiant.earth/mlhub/v1 \
234+
--conformance core --conformance features --conformance item-search \
235+
--auth-query-parameter 'key=xxx' \
236+
--collection lacuna_fund_eotg_v1_labels \
237+
--geometry '{ "type": "Polygon", "coordinates": [ [ [ -6.873149632157182, 13.306361128851238 ], [ -6.8729475
238+
45317309, 13.329493867068924 ], [ -6.8965701520705105, 13.329690854131131 ], [ -6.896769998632048, 13.30655776190765 ], [ -6.873149632157182, 13.306361128851238 ] ] ] }'
239+
```
240+
224241
### Sentinel Hub 1.0.0 Catalog
225242

226243
URL: <https://services.sentinel-hub.com/api/v1/catalog/1.0.0/>

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ Options:
117117
--conformance [core|browseable|item-search|features|collections|children|filter]
118118
The conformance classes to validate.
119119
[required]
120+
--auth-bearer-token TEXT Authorization Bearer token value to append
121+
to all requests.
122+
--auth-query-parameter TEXT Query pararmeter key and value to pass for
123+
authorization, e.g., 'key=xyz'.
120124
--help Show this message and exit.
121125
```
122126

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

161+
Example with authorization using parameters:
162+
163+
```
164+
stac-api-validator --root-url https://api.radiant.earth/mlhub/v1 --conformance core --auth-query-parameter 'key=xxx'
165+
```
166+
157167
## Validating OGC API Features - Part 1 compliance
158168

159169
A STAC API that conforms to the "STAC API - Features" conformance class will also be a valid implementation

src/stac_api_validator/__main__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,22 @@
4949
),
5050
help="The conformance classes to validate.",
5151
)
52+
@click.option(
53+
"--auth-bearer-token",
54+
help="Authorization Bearer token value to append to all requests.",
55+
)
56+
@click.option(
57+
"--auth-query-parameter",
58+
help="Query pararmeter key and value to pass for authorization, e.g., 'key=xyz'.",
59+
)
5260
def main(
5361
log_level: str,
5462
root_url: str,
5563
conformance_classes: List[str],
5664
collection: Optional[str],
5765
geometry: Optional[str],
66+
auth_bearer_token: Optional[str] = None,
67+
auth_query_parameter: Optional[str] = None,
5868
) -> int:
5969
"""STAC API Validator."""
6070

@@ -66,6 +76,8 @@ def main(
6676
conformance_classes=conformance_classes,
6777
collection=collection,
6878
geometry=geometry,
79+
auth_bearer_token=auth_bearer_token,
80+
auth_query_parameter=auth_query_parameter,
6981
)
7082
except Exception as e:
7183
print(f"Failed.\nError {root_url}: {type(e)} {str(e)}")

0 commit comments

Comments
 (0)