[Git][debian-gis-team/stac-check][upstream] New upstream version 1.5.0+ds
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Tue Jan 21 06:59:58 GMT 2025
Antonio Valentino pushed to branch upstream at Debian GIS Project / stac-check
Commits:
6313c4bd by Antonio Valentino at 2025-01-21T06:28:32+00:00
New upstream version 1.5.0+ds
- - - - -
11 changed files:
- CHANGELOG.md
- README.md
- docs/api.rst
- docs/cli.rst
- docs/conf.py
- docs/index.rst
- setup.py
- stac_check/cli.py
- stac_check/lint.py
- stac_check/logo.py
- tests/test_lint.py
Changes:
=====================================
CHANGELOG.md
=====================================
@@ -6,6 +6,25 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)
## Unreleased
+### Changed
+
+## [v1.5.0] - 2025-01-17
+
+### Added
+
+- Allow to provide HTTP headers ([#114](https://github.com/stac-utils/stac-check/pull/114))
+- Configure whether to open URLs when validating assets ([#114](https://github.com/stac-utils/stac-check/pull/114))
+
+### Changed
+
+- No longer use the deprecated pkg-resources package.
+ It has been replaced with importlib from the Python standard library
+ ([#112](https://github.com/stac-utils/stac-check/pull/112))
+
+### Updated
+
+- Updated stac-validator to v3.5.0 and other dependecies as well ([#116](https://github.com/stac-utils/stac-check/pull/116))
+
## [v1.4.0] - 2024-10-09
### Added
@@ -148,7 +167,8 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)
- Validation from stac-validator 2.3.0
- Links and assets validation checks
-[Unreleased]: https://github.com/stac-utils/stac-check/compare/v1.4.0...main
+[Unreleased]: https://github.com/stac-utils/stac-check/compare/v1.5.0...main
+[v1.5.0]: https://github.com/stac-utils/stac-check/compare/v1.4.0...v1.5.0
[v1.4.0]: https://github.com/stac-utils/stac-check/compare/v1.3.3...v1.4.0
[v1.3.3]: https://github.com/stac-utils/stac-check/compare/v1.3.2...v1.3.3
[v1.3.2]: https://github.com/stac-utils/stac-check/compare/v1.3.1...v1.3.2
=====================================
README.md
=====================================
@@ -1,14 +1,19 @@
# stac-check
+
## A linting and validation tool for STAC assets
The intent of this project is to provide a validation tool that also follows the official [STAC Best Practices document](https://github.com/radiantearth/stac-spec/blob/master/best-practices.md)
---
+
### Documentation
+
[stac-check.readthedocs.io](https://stac-check.readthedocs.io/en/latest/)
---
+
### Install
+
`$ pip install stac-check`
or for local development
@@ -16,7 +21,9 @@ or for local development
`$ pip install -e '.[dev]'`
---
+
### CLI Usage
+
```
Usage: stac-check [OPTIONS] FILE
@@ -28,16 +35,24 @@ Options:
argument to get full recursion. Ignored if
`recursive == False`.
-r, --recursive Recursively validate all related stac objects.
+ --no-assets-urls Disables the opening of href links when validating assets
+ (enabled by default).
+ --header KEY VALUE HTTP header to include in the requests. Can be used
+ multiple times.
--help Show this message and exit. Show this message and exit.
```
+
---
+
### Docker
```
$ make build
$ make shell
```
+
---
+
### Lint JSON
```
@@ -48,21 +63,24 @@ linter = Linter('<json_path>')
for k, v in linter.create_best_practices_dict().items():
print(k, ":", v)
```
+
---
+
### CLI Examples
-``` stac-check https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json --recursive ```
+`stac-check https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json --recursive`
+
```
____ ____ __ ___ ___ _ _ ____ ___ __ _
/ ___)(_ _)/ _\ / __)___ / __)/ )( \( __)/ __)( / )
\___ \ )( / \( (__(___)( (__ ) __ ( ) _)( (__ ) (
(____/ (__)\_/\_/ \___) \___)\_)(_/(____)\___)(__\_)
-stac-check: STAC spec validaton and linting tool
+stac-check: STAC spec validation and linting tool
-Please upgrade from version 0.9.0 to version 1.0.0!
+Please upgrade from version 0.9.0 to version 1.1.0!
-Validator: stac-validator 3.1.0
+Validator: stac-validator 3.5.0
Recursive: Validate all assets in a collection or catalog
@@ -96,13 +114,13 @@ Error Message: Expecting value: line 1 column 1 (char 0)
-------------------------
```
-``` stac-check sample_files/0.9.0/landsat8-sample.json```
+` stac-check sample_files/0.9.0/landsat8-sample.json`
-<pre><b>stac-check: STAC spec validaton and linting tool</b>
+<pre><b>stac-check: STAC spec validation and linting tool</b>
-Please upgrade from version 0.9.0 to version 1.0.0!
+Please upgrade from version 0.9.0 to version 1.1.0!
-Validator: stac-validator 2.3.0
+Validator: stac-validator 3.5.0
Valid ITEM: True
@@ -124,13 +142,14 @@ STAC Best Practices:
This object has 4 links
</pre>
-``` stac-check sample_files/1.0.0/core-item.json --assets```
+` stac-check sample_files/1.0.0/core-item.json --assets`
+
<pre>
-<b>stac-check: STAC spec validaton and linting tool</b>
+<b>stac-check: STAC spec validation and linting tool</b>
-Thanks for using STAC version 1.0.0!
+Please upgrade from version 1.0.0 to version 1.1.0!
-Validator: stac-validator 2.3.0
+Validator: stac-validator 3.5.0
Valid ITEM: True
@@ -157,15 +176,14 @@ ASSET request errors:
This object has 4 links
</pre>
+` stac-check sample_files/1.0.0/core-item-bad-links.json --links --assets`
-
-``` stac-check sample_files/1.0.0/core-item-bad-links.json --links --assets```
<pre>
-<b>stac-check: STAC spec validaton and linting tool</b>
+<b>stac-check: STAC spec validation and linting tool</b>
-Thanks for using STAC version 1.0.0!
+Please upgrade from version 1.0.0 to version 1.1.0!
-Validator: stac-validator 2.3.0
+Validator: stac-validator 3.5.0
Valid ITEM: True
@@ -201,13 +219,14 @@ LINK request errors:
This object has 4 links
</pre>
-``` stac-check sample_files/0.9.0/bad-item.json```
+` stac-check sample_files/0.9.0/bad-item.json`
+
<pre>
-<b>stac-check: STAC spec validaton and linting tool</b>
+<b>stac-check: STAC spec validation and linting tool</b>
-Please upgrade from version 0.9.0 to version 1.0.0!
+Please upgrade from version 0.9.0 to version 1.1.0!
-Validator: stac-validator 2.3.0
+Validator: stac-validator 3.5.0
Valid : False
@@ -224,6 +243,34 @@ Validation error message:
This object has 5 links
</pre>
+
+` stac-check https://stac-catalog.eu/collections/sentinel-s2-l2a/items/item1 --assets --no-assets-urls --header x-api-key $MY_API_KEY --header foo bar`
+
+<pre>
+<b>stac-check: STAC spec validation and linting tool</b>
+
+Please upgrade from version 1.0.0 to version 1.1.0!
+
+Validator: stac-validator 3.5.0
+
+Valid ITEM: True
+
+Schemas validated:
+ https://stac-extensions.github.io/timestamps/v1.1.0/schema.json
+ https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json
+
+STAC Best Practices:
+ A STAC collection should contain a summaries field
+ It is recommended to store information like eo:bands in summaries
+
+
+No ASSET format errors!
+
+This object has 4 links
+</pre>
+
---
+
### Create local docs in the /docs folder
-`$ pdoc --html --output-dir pdoc stac_check --force`
+
+`$ pdoc --output-dir pdoc ./stac_check`
=====================================
docs/api.rst
=====================================
@@ -30,7 +30,7 @@ API Reference
<summary>
<span>Expand source code</span>
</summary>
- <pre><code class="python">import pkg_resources
+ <pre><code class="python">
from stac_validator.validate import StacValidate
from stac_validator.utilities import is_valid_url
import json
@@ -40,7 +40,8 @@ API Reference
import requests
from typing import Optional, Union, Dict, Any, List
from dotenv import load_dotenv
- import pkg_resources
+ import importlib.metadata
+ import importlib.resources
load_dotenv()
@@ -162,7 +163,7 @@ API Reference
self.config = self.parse_config(self.config_file)
self.asset_type = self.message["asset_type"] if "asset_type" in self.message else ""
self.version = self.message["version"] if "version" in self.message else ""
- self.validator_version = pkg_resources.require("stac-validator")[0].version
+ self.validator_version = importlib.metadata.distribution("stac-validator").version
self.validate_all = self.recursive_validation(self.item)
self.valid_stac = self.message["valid_stac"]
self.error_type = self.check_error_type()
@@ -205,7 +206,7 @@ API Reference
with open(default_config_file) as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
else:
- with pkg_resources.resource_stream(__name__, "stac-check.config.yml") as f:
+ with importlib.resources.open_text(__name__, "stac-check.config.yml") as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
if config_file:
with open(config_file) as f:
@@ -866,7 +867,7 @@ API Reference
self.config = self.parse_config(self.config_file)
self.asset_type = self.message["asset_type"] if "asset_type" in self.message else ""
self.version = self.message["version"] if "version" in self.message else ""
- self.validator_version = pkg_resources.require("stac-validator")[0].version
+ self.validator_version = importlib.metadata.distribution("stac-validator").version
self.validate_all = self.recursive_validation(self.item)
self.valid_stac = self.message["valid_stac"]
self.error_type = self.check_error_type()
@@ -909,7 +910,7 @@ API Reference
with open(default_config_file) as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
else:
- with pkg_resources.resource_stream(__name__, "stac-check.config.yml") as f:
+ with importlib.resources.open_text(__name__, "stac-check.config.yml") as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
if config_file:
with open(config_file) as f:
@@ -1416,7 +1417,7 @@ API Reference
with open(default_config_file) as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
else:
- with pkg_resources.resource_stream(__name__, "stac-check.config.yml") as f:
+ with importlib.resources.open_text(__name__, "stac-check.config.yml") as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
if config_file:
with open(config_file) as f:
=====================================
docs/cli.rst
=====================================
@@ -32,7 +32,7 @@ CLI Reference
</summary>
<pre><code class="python">import click
from .lint import Linter
- import pkg_resources
+ import importlib.matadata
def link_asset_message(link_list:list, type: str, format: str) -> None:
"""Prints a list of links or assets and any errors associated with them.
@@ -102,7 +102,7 @@ CLI Reference
(____/ (__)\_/\_/ \___) \___)\_)(_/(____)\___)(__\_)
""")
- click.secho("stac-check: STAC spec validaton and linting tool", bold=True)
+ click.secho("stac-check: STAC spec validation and linting tool", bold=True)
click.secho()
@@ -205,7 +205,7 @@ CLI Reference
)
@click.command()
@click.argument('file')
- @click.version_option(version=pkg_resources.require("stac-check")[0].version)
+ @click.version_option(version=importlib.metadata.distribution("stac-check").version)
def main(file, recursive, max_depth, assets, links):
linter = Linter(file, assets=assets, links=links, recursive=recursive, max_depth=max_depth)
intro_message(linter)
@@ -351,7 +351,7 @@ CLI Reference
(____/ (__)\_/\_/ \___) \___)\_)(_/(____)\___)(__\_)
""")
- click.secho("stac-check: STAC spec validaton and linting tool", bold=True)
+ click.secho("stac-check: STAC spec validation and linting tool", bold=True)
click.secho()
=====================================
docs/conf.py
=====================================
@@ -10,7 +10,7 @@ from typing import List
project = "stac-check"
author = "Jonathan Healy"
-release = "1.3.1"
+release = "1.5.0"
# -- General configuration ---------------------------------------------------
=====================================
docs/index.rst
=====================================
@@ -41,10 +41,14 @@ CLI Usage
-l, --links Validate links for format and response.
-a, --assets Validate assets for format and response.
-m, --max-depth INTEGER Maximum depth to traverse when recursing. Omit this
- argument to get full recursion. Ignored if
- `recursive == False`.
+ argument to get full recursion. Ignored if
+ `recursive == False`.
-r, --recursive Recursively validate all related stac objects.
- --help Show this message and exit.
+ --no-assets-urls Disables the opening of href links when validating assets
+ (enabled by default).
+ --header KEY VALUE HTTP header to include in the requests. Can be used
+ multiple times.
+ --help Show this message and exit. Show this message and exit.
Examples
~~~~~~~~
@@ -91,7 +95,7 @@ STAC Versions supported
``stac-check`` supports the following STAC versions:
-``[0.8.0, 0.8.1, 0.9.0, 1.0.0-beta.1, 1.0.0-beta.2, 1.0.0-rc.1, 1.0.0-rc.2, 1.0.0-rc.3, 1.0.0-rc.4, 1.0.0]``
+``[0.8.0, 0.8.1, 0.9.0, 1.0.0-beta.1, 1.0.0-beta.2, 1.0.0-rc.1, 1.0.0-rc.2, 1.0.0-rc.3, 1.0.0-rc.4, 1.0.0, 1.1.0]``
.. toctree::
:maxdepth: 1
=====================================
setup.py
=====================================
@@ -3,7 +3,7 @@
from setuptools import find_packages, setup
-__version__ = "1.4.0"
+__version__ = "1.5.0"
with open("README.md", "r") as fh:
long_description = fh.read()
@@ -15,18 +15,19 @@ setup(
url="https://github.com/stac-utils/stac-check",
packages=find_packages(exclude=("tests",)),
include_package_data=True,
+ setup_requires=["setuptools"],
install_requires=[
- "click>=8.0.0",
- "requests>=2.19.1",
- "jsonschema>=3.1.2",
- "stac-validator>=3.4.0",
+ "requests>=2.32.3",
+ "jsonschema>=4.23.0",
+ "click>=8.1.8",
+ "stac-validator>=3.5.0",
"PyYAML",
"python-dotenv",
- "setuptools",
],
extras_require={
"dev": [
"pytest",
+ "requests-mock",
"types-setuptools",
],
},
=====================================
stac_check/cli.py
=====================================
@@ -1,17 +1,21 @@
+import importlib.metadata
+
import click
-import pkg_resources
from .lint import Linter
from .logo import logo
-def link_asset_message(link_list: list, type: str, format: str) -> None:
+def link_asset_message(
+ link_list: list, type: str, format: str, healthy_msg: bool
+) -> None:
"""Prints a list of links or assets and any errors associated with them.
Args:
link_list (list): A list of links or assets.
type (str): The type of link or asset being processed.
format (str): The format or request being used.
+ healthy_msg (bool): Whether to display "No TYPE errors!" or not
Returns:
None.
@@ -20,7 +24,7 @@ def link_asset_message(link_list: list, type: str, format: str) -> None:
click.secho(f"{type.upper()} {format} errors: ", fg="red")
for asset in link_list:
click.secho(f" {asset}")
- else:
+ elif healthy_msg:
click.secho(f"No {type.upper()} {format} errors!", fg="green")
@@ -38,7 +42,9 @@ def recursive_message(linter: Linter) -> None:
click.secho(f"Max-depth = {linter.max_depth}")
click.secho("-------------------------")
for count, msg in enumerate(linter.validate_all):
- click.secho(f"Asset {count+1} Validated: {msg['path']}", bg="white", fg="black")
+ click.secho(
+ f"Asset {count + 1} Validated: {msg['path']}", bg="white", fg="black"
+ )
click.secho()
if msg["valid_stac"] == True:
recursive_linter = Linter(msg["path"], recursive=True)
@@ -70,11 +76,11 @@ def intro_message(linter: Linter) -> None:
"""
click.secho(logo)
- click.secho("stac-check: STAC spec validaton and linting tool", bold=True)
+ click.secho("stac-check: STAC spec validation and linting tool", bold=True)
click.secho()
- if linter.version == "1.0.0":
+ if linter.version == "1.1.0":
click.secho(linter.set_update_message(), fg="green")
else:
click.secho(linter.set_update_message(), fg="red")
@@ -127,19 +133,21 @@ def cli_message(linter: Linter) -> None:
if linter.invalid_asset_format is not None:
click.secho()
- link_asset_message(linter.invalid_asset_format, "asset", "format")
+ link_asset_message(linter.invalid_asset_format, "asset", "format", True)
if linter.invalid_asset_request is not None:
click.secho()
- link_asset_message(linter.invalid_asset_request, "asset", "request")
+ link_asset_message(
+ linter.invalid_asset_request, "asset", "request", linter.assets_open_urls
+ )
if linter.invalid_link_format is not None:
click.secho()
- link_asset_message(linter.invalid_link_format, "link", "format")
+ link_asset_message(linter.invalid_link_format, "link", "format", True)
if linter.invalid_link_request is not None:
click.secho()
- link_asset_message(linter.invalid_link_request, "link", "request")
+ link_asset_message(linter.invalid_link_request, "link", "request", True)
if linter.error_type != "":
click.secho("Validation error type: ", fg="red")
@@ -175,12 +183,29 @@ def cli_message(linter: Linter) -> None:
@click.option(
"-l", "--links", is_flag=True, help="Validate links for format and response."
)
+ at click.option(
+ "--no-assets-urls",
+ is_flag=True,
+ help="Disables the opening of href links when validating assets (enabled by default).",
+)
+ at click.option(
+ "--header",
+ type=(str, str),
+ multiple=True,
+ help="HTTP header to include in the requests. Can be used multiple times.",
+)
@click.command()
@click.argument("file")
- at click.version_option(version=pkg_resources.require("stac-check")[0].version)
-def main(file, recursive, max_depth, assets, links):
+ at click.version_option(version=importlib.metadata.distribution("stac-check").version)
+def main(file, recursive, max_depth, assets, links, no_assets_urls, header):
linter = Linter(
- file, assets=assets, links=links, recursive=recursive, max_depth=max_depth
+ file,
+ assets=assets,
+ links=links,
+ recursive=recursive,
+ max_depth=max_depth,
+ assets_open_urls=not no_assets_urls,
+ headers=dict(header),
)
intro_message(linter)
if recursive > 0:
=====================================
stac_check/lint.py
=====================================
@@ -1,9 +1,10 @@
+import importlib.metadata
+import importlib.resources
import json
import os
-from dataclasses import dataclass
+from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
-import pkg_resources
import requests
import yaml
from dotenv import load_dotenv
@@ -24,6 +25,8 @@ class Linter:
links (bool, optional): A boolean value indicating whether to validate links. Defaults to False.
recursive (bool, optional): A boolean value indicating whether to perform recursive validation. Defaults to False.
max_depth (Optional[int], optional): An optional integer indicating the maximum depth to validate recursively. Defaults to None.
+ assets_open_urls (bool): Whether to open assets URLs when validating assets. Defaults to True.
+ headers (dict): HTTP headers to include in the requests.
Attributes:
data (dict): A dictionary representing the STAC JSON file.
@@ -125,6 +128,8 @@ class Linter:
links: bool = False
recursive: bool = False
max_depth: Optional[int] = None
+ assets_open_urls: bool = True
+ headers: dict = field(default_factory=dict)
def __post_init__(self):
self.data = self.load_data(self.item)
@@ -134,7 +139,9 @@ class Linter:
self.message["asset_type"] if "asset_type" in self.message else ""
)
self.version = self.message["version"] if "version" in self.message else ""
- self.validator_version = pkg_resources.require("stac-validator")[0].version
+ self.validator_version = importlib.metadata.distribution(
+ "stac-validator"
+ ).version
self.validate_all = self.recursive_validation(self.item)
self.valid_stac = self.message["valid_stac"]
self.error_type = self.check_error_type()
@@ -185,7 +192,9 @@ class Linter:
with open(default_config_file) as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
else:
- with pkg_resources.resource_stream(__name__, "stac-check.config.yml") as f:
+ with importlib.resources.open_text(
+ "stac_check", "stac-check.config.yml"
+ ) as f:
default_config = yaml.load(f, Loader=yaml.FullLoader)
if config_file:
with open(config_file) as f:
@@ -231,7 +240,7 @@ class Linter:
if isinstance(file, str):
if is_valid_url(file):
- resp = requests.get(file)
+ resp = requests.get(file, headers=self.headers)
data = resp.json()
else:
with open(file) as json_file:
@@ -255,10 +264,18 @@ class Linter:
ValueError: If `file` is not a valid file path or STAC dictionary.
"""
if isinstance(file, str):
- stac = StacValidate(file, links=self.links, assets=self.assets)
+ stac = StacValidate(
+ file,
+ links=self.links,
+ assets=self.assets,
+ assets_open_urls=self.assets_open_urls,
+ headers=self.headers,
+ )
stac.run()
elif isinstance(file, dict):
- stac = StacValidate()
+ stac = StacValidate(
+ assets_open_urls=self.assets_open_urls, headers=self.headers
+ )
stac.validate_dict(file)
else:
raise ValueError("Input must be a file path or STAC dictionary.")
@@ -279,10 +296,21 @@ class Linter:
"""
if self.recursive:
if isinstance(file, str):
- stac = StacValidate(file, recursive=True, max_depth=self.max_depth)
+ stac = StacValidate(
+ file,
+ recursive=True,
+ max_depth=self.max_depth,
+ assets_open_urls=self.assets_open_urls,
+ headers=self.headers,
+ )
stac.run()
else:
- stac = StacValidate(recursive=True, max_depth=self.max_depth)
+ stac = StacValidate(
+ recursive=True,
+ max_depth=self.max_depth,
+ assets_open_urls=self.assets_open_urls,
+ headers=self.headers,
+ )
stac.validate_dict(file)
return stac.message
else:
@@ -294,10 +322,10 @@ class Linter:
Returns:
A string containing a message for users to update their STAC version.
"""
- if self.version != "1.0.0":
- return f"Please upgrade from version {self.version} to version 1.0.0!"
+ if self.version != "1.1.0":
+ return f"Please upgrade from version {self.version} to version 1.1.0!"
else:
- return "Thanks for using STAC version 1.0.0!"
+ return "Thanks for using STAC version 1.1.0!"
def check_links_assets(
self, num_links: int, url_type: str, format_type: str
=====================================
stac_check/logo.py
=====================================
@@ -1,6 +1,6 @@
# flake8: noqa
-logo = """
+logo = r"""
____ ____ __ ___ ___ _ _ ____ ___ __ _
/ ___)(_ _)/ _\ / __)___ / __)/ )( \( __)/ __)( / )
\___ \ )( / \( (__(___)( (__ ) __ ( ) _)( (__ ) (
=====================================
tests/test_lint.py
=====================================
@@ -1,4 +1,7 @@
+import json
+
import pytest
+import requests_mock
from stac_check.lint import Linter
@@ -498,3 +501,65 @@ def test_lint_dict_item():
assert linter.create_best_practices_dict()["datetime_null"] == [
"Please avoid setting the datetime field to null, many clients search on this field"
]
+
+
+def test_lint_header():
+ file = "sample_files/1.0.0/core-item.json"
+ url = "https://localhost/" + file
+
+ no_headers = {}
+ valid_headers = {"x-api-key": "a-valid-api-key"}
+
+ with requests_mock.Mocker(real_http=True) as mock, open(file) as json_data:
+ mock.get(url, request_headers=no_headers, status_code=403, json={})
+ mock.get(url, request_headers=valid_headers, json=json.load(json_data))
+
+ linter = Linter(url, assets=False, headers=valid_headers)
+ assert linter.message == {
+ "version": "1.0.0",
+ "path": "https://localhost/sample_files/1.0.0/core-item.json",
+ "schema": [
+ "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
+ ],
+ "valid_stac": True,
+ "asset_type": "ITEM",
+ "validation_method": "default",
+ }
+
+ linter = Linter(url, assets=False, headers=no_headers)
+ assert linter.message == {
+ "version": "",
+ "path": "https://localhost/sample_files/1.0.0/core-item.json",
+ "schema": [""],
+ "valid_stac": False,
+ "error_type": "HTTPError",
+ "error_message": "403 Client Error: None for url: https://localhost/sample_files/1.0.0/core-item.json",
+ }
+
+
+def test_lint_assets_no_links():
+ file = "sample_files/1.0.0/core-item.json"
+ linter = Linter(file, assets=True, assets_open_urls=False)
+ assert linter.message == {
+ "version": "1.0.0",
+ "path": file,
+ "schema": [
+ "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
+ ],
+ "valid_stac": True,
+ "asset_type": "ITEM",
+ "validation_method": "default",
+ "assets_validated": {
+ "format_valid": [
+ "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2_analytic.tif",
+ "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.jpg",
+ "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.tif",
+ "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2_analytic_udm.tif",
+ "http://remotedata.io/catalog/20201211_223832_CS2/extended-metadata.json",
+ "http://cool-sat.com/catalog/20201211_223832_CS2/20201211_223832_CS2.EPH",
+ ],
+ "format_invalid": [],
+ "request_valid": [],
+ "request_invalid": [],
+ },
+ }
View it on GitLab: https://salsa.debian.org/debian-gis-team/stac-check/-/commit/6313c4bda4c2480ec88e3bd3811a0e6ebefaf9be
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/stac-check/-/commit/6313c4bda4c2480ec88e3bd3811a0e6ebefaf9be
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20250121/348e113b/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list