stac-fastapi.extensions 3.0.4__tar.gz → 4.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/PKG-INFO +16 -6
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/setup.py +3 -4
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/collection_search/collection_search.py +4 -17
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/collection_search/request.py +25 -8
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/filter/request.py +4 -2
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/version.py +1 -1
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi.extensions.egg-info/PKG-INFO +16 -6
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi.extensions.egg-info/requires.txt +2 -2
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_collection_search.py +22 -25
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_filter.py +4 -2
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/README.md +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/setup.cfg +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/aggregation/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/aggregation/aggregation.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/aggregation/client.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/aggregation/request.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/aggregation/types.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/collection_search/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/collection_search/client.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/fields/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/fields/fields.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/fields/request.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/filter/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/filter/client.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/filter/filter.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/free_text/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/free_text/free_text.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/free_text/request.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/pagination/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/pagination/offset_pagination.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/pagination/pagination.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/pagination/request.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/pagination/token_pagination.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/query/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/query/query.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/query/request.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/sort/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/sort/request.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/sort/sort.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/core/transaction.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/third_party/__init__.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/third_party/bulk_transactions.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi.extensions.egg-info/SOURCES.txt +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi.extensions.egg-info/dependency_links.txt +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi.extensions.egg-info/not-zip-safe +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi.extensions.egg-info/top_level.txt +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_aggregation.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_free_text.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_pagination.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_query.py +0 -0
- {stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_transaction.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: stac-fastapi.extensions
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0
|
|
4
4
|
Summary: An implementation of STAC API based on the FastAPI framework.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi
|
|
6
6
|
Author: Arturo Engineering
|
|
@@ -10,17 +10,16 @@ Keywords: STAC FastAPI COG
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Intended Audience :: Information Technology
|
|
12
12
|
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
18
|
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.9
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: stac-fastapi.types~=
|
|
23
|
-
Requires-Dist: stac-fastapi.api~=
|
|
21
|
+
Requires-Dist: stac-fastapi.types~=4.0
|
|
22
|
+
Requires-Dist: stac-fastapi.api~=4.0
|
|
24
23
|
Provides-Extra: dev
|
|
25
24
|
Requires-Dist: pytest; extra == "dev"
|
|
26
25
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -31,3 +30,14 @@ Provides-Extra: docs
|
|
|
31
30
|
Requires-Dist: mkdocs; extra == "docs"
|
|
32
31
|
Requires-Dist: mkdocs-material; extra == "docs"
|
|
33
32
|
Requires-Dist: pdocs; extra == "docs"
|
|
33
|
+
Dynamic: author
|
|
34
|
+
Dynamic: author-email
|
|
35
|
+
Dynamic: classifier
|
|
36
|
+
Dynamic: description-content-type
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: keywords
|
|
39
|
+
Dynamic: license
|
|
40
|
+
Dynamic: provides-extra
|
|
41
|
+
Dynamic: requires-dist
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
Dynamic: summary
|
|
@@ -7,8 +7,8 @@ with open("README.md") as f:
|
|
|
7
7
|
desc = f.read()
|
|
8
8
|
|
|
9
9
|
install_requires = [
|
|
10
|
-
"stac-fastapi.types~=
|
|
11
|
-
"stac-fastapi.api~=
|
|
10
|
+
"stac-fastapi.types~=4.0",
|
|
11
|
+
"stac-fastapi.api~=4.0",
|
|
12
12
|
]
|
|
13
13
|
|
|
14
14
|
extra_reqs = {
|
|
@@ -28,12 +28,11 @@ setup(
|
|
|
28
28
|
description="An implementation of STAC API based on the FastAPI framework.",
|
|
29
29
|
long_description=desc,
|
|
30
30
|
long_description_content_type="text/markdown",
|
|
31
|
-
python_requires=">=3.
|
|
31
|
+
python_requires=">=3.9",
|
|
32
32
|
classifiers=[
|
|
33
33
|
"Intended Audience :: Developers",
|
|
34
34
|
"Intended Audience :: Information Technology",
|
|
35
35
|
"Intended Audience :: Science/Research",
|
|
36
|
-
"Programming Language :: Python :: 3.8",
|
|
37
36
|
"Programming Language :: Python :: 3.9",
|
|
38
37
|
"Programming Language :: Python :: 3.10",
|
|
39
38
|
"Programming Language :: Python :: 3.11",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Collection-Search extension."""
|
|
2
2
|
|
|
3
|
-
import warnings
|
|
4
3
|
from enum import Enum
|
|
5
4
|
from typing import List, Optional, Union
|
|
6
5
|
|
|
@@ -79,7 +78,7 @@ class CollectionSearchExtension(ApiExtension):
|
|
|
79
78
|
schema_href: Optional[str] = None,
|
|
80
79
|
) -> "CollectionSearchExtension":
|
|
81
80
|
"""Create CollectionSearchExtension object from extensions."""
|
|
82
|
-
|
|
81
|
+
known_extension_conformances = {
|
|
83
82
|
"FreeTextExtension": ConformanceClasses.FREETEXT,
|
|
84
83
|
"FreeTextAdvancedExtension": ConformanceClasses.FREETEXT,
|
|
85
84
|
"QueryExtension": ConformanceClasses.QUERY,
|
|
@@ -92,13 +91,7 @@ class CollectionSearchExtension(ApiExtension):
|
|
|
92
91
|
ConformanceClasses.BASIS,
|
|
93
92
|
]
|
|
94
93
|
for ext in extensions:
|
|
95
|
-
conf
|
|
96
|
-
if not conf:
|
|
97
|
-
warnings.warn(
|
|
98
|
-
f"Conformance class for `{ext.__class__.__name__}` extension not found.", # noqa: E501
|
|
99
|
-
UserWarning,
|
|
100
|
-
)
|
|
101
|
-
else:
|
|
94
|
+
if conf := known_extension_conformances.get(ext.__class__.__name__, None):
|
|
102
95
|
conformance_classes.append(conf)
|
|
103
96
|
|
|
104
97
|
get_request_model = create_request_model(
|
|
@@ -187,7 +180,7 @@ class CollectionSearchPostExtension(CollectionSearchExtension):
|
|
|
187
180
|
router: Optional[APIRouter] = None,
|
|
188
181
|
) -> "CollectionSearchPostExtension":
|
|
189
182
|
"""Create CollectionSearchPostExtension object from extensions."""
|
|
190
|
-
|
|
183
|
+
known_extension_conformances = {
|
|
191
184
|
"FreeTextExtension": ConformanceClasses.FREETEXT,
|
|
192
185
|
"FreeTextAdvancedExtension": ConformanceClasses.FREETEXT,
|
|
193
186
|
"QueryExtension": ConformanceClasses.QUERY,
|
|
@@ -200,13 +193,7 @@ class CollectionSearchPostExtension(CollectionSearchExtension):
|
|
|
200
193
|
ConformanceClasses.BASIS,
|
|
201
194
|
]
|
|
202
195
|
for ext in extensions:
|
|
203
|
-
conf
|
|
204
|
-
if not conf:
|
|
205
|
-
warnings.warn(
|
|
206
|
-
f"Conformance class for `{ext.__class__.__name__}` extension not found.", # noqa: E501
|
|
207
|
-
UserWarning,
|
|
208
|
-
)
|
|
209
|
-
else:
|
|
196
|
+
if conf := known_extension_conformances.get(ext.__class__.__name__, None):
|
|
210
197
|
conformance_classes.append(conf)
|
|
211
198
|
|
|
212
199
|
get_request_model = create_request_model(
|
|
@@ -10,23 +10,22 @@ from stac_pydantic.api.search import SearchDatetime
|
|
|
10
10
|
from stac_pydantic.shared import BBox
|
|
11
11
|
from typing_extensions import Annotated
|
|
12
12
|
|
|
13
|
-
from stac_fastapi.types.rfc3339 import DateTimeType
|
|
14
13
|
from stac_fastapi.types.search import (
|
|
15
14
|
APIRequest,
|
|
15
|
+
DatetimeMixin,
|
|
16
|
+
DateTimeQueryType,
|
|
16
17
|
Limit,
|
|
17
18
|
_bbox_converter,
|
|
18
|
-
|
|
19
|
+
_validate_datetime,
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
@attr.s
|
|
23
|
-
class BaseCollectionSearchGetRequest(APIRequest):
|
|
24
|
+
class BaseCollectionSearchGetRequest(APIRequest, DatetimeMixin):
|
|
24
25
|
"""Basics additional Collection-Search parameters for the GET request."""
|
|
25
26
|
|
|
26
27
|
bbox: Optional[BBox] = attr.ib(default=None, converter=_bbox_converter)
|
|
27
|
-
datetime:
|
|
28
|
-
default=None, converter=_datetime_converter
|
|
29
|
-
)
|
|
28
|
+
datetime: DateTimeQueryType = attr.ib(default=None, validator=_validate_datetime)
|
|
30
29
|
limit: Annotated[
|
|
31
30
|
Optional[Limit],
|
|
32
31
|
Query(
|
|
@@ -38,8 +37,26 @@ class BaseCollectionSearchGetRequest(APIRequest):
|
|
|
38
37
|
class BaseCollectionSearchPostRequest(BaseModel):
|
|
39
38
|
"""Collection-Search POST model."""
|
|
40
39
|
|
|
41
|
-
bbox: Optional[BBox] =
|
|
42
|
-
|
|
40
|
+
bbox: Optional[BBox] = Field(
|
|
41
|
+
default=None,
|
|
42
|
+
description="Only return items intersecting this bounding box. Mutually exclusive with **intersects**.", # noqa: E501
|
|
43
|
+
json_schema_extra={
|
|
44
|
+
"example": [-175.05, -85.05, 175.05, 85.05],
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
datetime: Optional[str] = Field(
|
|
48
|
+
default=None,
|
|
49
|
+
description="""Only return items that have a temporal property that intersects this value.\n
|
|
50
|
+
Either a date-time or an interval, open or closed. Date and time expressions adhere to RFC 3339. Open intervals are expressed using double-dots.""", # noqa: E501
|
|
51
|
+
json_schema_extra={
|
|
52
|
+
"examples": {
|
|
53
|
+
"datetime": {"value": "2018-02-12T23:20:50Z"},
|
|
54
|
+
"closed-interval": {"value": "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"},
|
|
55
|
+
"open-interval-from": {"value": "2018-02-12T00:00:00Z/.."},
|
|
56
|
+
"open-interval-to": {"value": "../2018-03-18T12:31:12Z"},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
)
|
|
43
60
|
limit: Optional[Limit] = Field(
|
|
44
61
|
10,
|
|
45
62
|
description="Limits the number of results that are included in each page of the response (capped to 10_000).", # noqa: E501
|
|
@@ -16,9 +16,10 @@ FilterLang = Literal["cql-json", "cql2-json", "cql2-text"]
|
|
|
16
16
|
class FilterExtensionGetRequest(APIRequest):
|
|
17
17
|
"""Filter extension GET request model."""
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
filter_expr: Annotated[
|
|
20
20
|
Optional[str],
|
|
21
21
|
Query(
|
|
22
|
+
alias="filter",
|
|
22
23
|
description="""A CQL filter expression for filtering items.\n
|
|
23
24
|
Supports `CQL-JSON` as defined in https://portal.ogc.org/files/96288\n
|
|
24
25
|
Remember to URL encode the CQL-JSON if using GET""",
|
|
@@ -46,8 +47,9 @@ Remember to URL encode the CQL-JSON if using GET""",
|
|
|
46
47
|
class FilterExtensionPostRequest(BaseModel):
|
|
47
48
|
"""Filter extension POST request model."""
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
filter_expr: Optional[Dict[str, Any]] = Field(
|
|
50
51
|
default=None,
|
|
52
|
+
alias="filter",
|
|
51
53
|
description="A CQL filter expression for filtering items.",
|
|
52
54
|
json_schema_extra={
|
|
53
55
|
"example": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: stac-fastapi.extensions
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0
|
|
4
4
|
Summary: An implementation of STAC API based on the FastAPI framework.
|
|
5
5
|
Home-page: https://github.com/stac-utils/stac-fastapi
|
|
6
6
|
Author: Arturo Engineering
|
|
@@ -10,17 +10,16 @@ Keywords: STAC FastAPI COG
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Intended Audience :: Information Technology
|
|
12
12
|
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
18
|
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.9
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: stac-fastapi.types~=
|
|
23
|
-
Requires-Dist: stac-fastapi.api~=
|
|
21
|
+
Requires-Dist: stac-fastapi.types~=4.0
|
|
22
|
+
Requires-Dist: stac-fastapi.api~=4.0
|
|
24
23
|
Provides-Extra: dev
|
|
25
24
|
Requires-Dist: pytest; extra == "dev"
|
|
26
25
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -31,3 +30,14 @@ Provides-Extra: docs
|
|
|
31
30
|
Requires-Dist: mkdocs; extra == "docs"
|
|
32
31
|
Requires-Dist: mkdocs-material; extra == "docs"
|
|
33
32
|
Requires-Dist: pdocs; extra == "docs"
|
|
33
|
+
Dynamic: author
|
|
34
|
+
Dynamic: author-email
|
|
35
|
+
Dynamic: classifier
|
|
36
|
+
Dynamic: description-content-type
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: keywords
|
|
39
|
+
Dynamic: license
|
|
40
|
+
Dynamic: provides-extra
|
|
41
|
+
Dynamic: requires-dist
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
Dynamic: summary
|
{stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/tests/test_collection_search.py
RENAMED
|
@@ -120,10 +120,7 @@ def test_collection_search_extension_default():
|
|
|
120
120
|
assert response.is_success, response.json()
|
|
121
121
|
response_dict = response.json()
|
|
122
122
|
assert [-175.05, -85.05, 175.05, 85.05] == response_dict["bbox"]
|
|
123
|
-
assert [
|
|
124
|
-
"2020-06-13T13:00:00+00:00",
|
|
125
|
-
"2020-06-13T14:00:00+00:00",
|
|
126
|
-
] == response_dict["datetime"]
|
|
123
|
+
assert "2020-06-13T13:00:00Z/2020-06-13T14:00:00Z" == response_dict["datetime"]
|
|
127
124
|
assert 100 == response_dict["limit"]
|
|
128
125
|
|
|
129
126
|
|
|
@@ -188,7 +185,7 @@ def test_collection_search_extension_models():
|
|
|
188
185
|
assert "datetime" in response_dict
|
|
189
186
|
assert "limit" in response_dict
|
|
190
187
|
assert "q" in response_dict
|
|
191
|
-
assert "
|
|
188
|
+
assert "filter_expr" in response_dict
|
|
192
189
|
assert "query" in response_dict
|
|
193
190
|
assert "sortby" in response_dict
|
|
194
191
|
assert "fields" in response_dict
|
|
@@ -211,13 +208,12 @@ def test_collection_search_extension_models():
|
|
|
211
208
|
assert response.is_success, response.json()
|
|
212
209
|
response_dict = response.json()
|
|
213
210
|
assert [-175.05, -85.05, 175.05, 85.05] == response_dict["bbox"]
|
|
214
|
-
assert [
|
|
215
|
-
"2020-06-13T13:00:00+00:00",
|
|
216
|
-
"2020-06-13T14:00:00+00:00",
|
|
217
|
-
] == response_dict["datetime"]
|
|
211
|
+
assert "2020-06-13T13:00:00Z/2020-06-13T14:00:00Z" == response_dict["datetime"]
|
|
218
212
|
assert 100 == response_dict["limit"]
|
|
219
213
|
assert ["EO", "Earth Observation"] == response_dict["q"]
|
|
220
|
-
assert
|
|
214
|
+
assert (
|
|
215
|
+
"id='item_id' AND collection='collection_id'" == response_dict["filter_expr"]
|
|
216
|
+
)
|
|
221
217
|
assert "filter_crs" in response_dict
|
|
222
218
|
assert "cql2-text" in response_dict["filter_lang"]
|
|
223
219
|
assert "query" in response_dict
|
|
@@ -353,7 +349,7 @@ def test_collection_search_extension_post_models():
|
|
|
353
349
|
assert "datetime" in response_dict
|
|
354
350
|
assert "limit" in response_dict
|
|
355
351
|
assert "q" in response_dict
|
|
356
|
-
assert "
|
|
352
|
+
assert "filter_expr" in response_dict
|
|
357
353
|
assert "query" in response_dict
|
|
358
354
|
assert "sortby" in response_dict
|
|
359
355
|
assert "fields" in response_dict
|
|
@@ -394,7 +390,7 @@ def test_collection_search_extension_post_models():
|
|
|
394
390
|
assert "2020-06-13T13:00:00Z/2020-06-13T14:00:00Z" == response_dict["datetime"]
|
|
395
391
|
assert 10_000 == response_dict["limit"]
|
|
396
392
|
assert ["EO", "Earth Observation"] == response_dict["q"]
|
|
397
|
-
assert response_dict["
|
|
393
|
+
assert response_dict["filter_expr"]
|
|
398
394
|
assert "filter_crs" in response_dict
|
|
399
395
|
assert "cql2-json" in response_dict["filter_lang"]
|
|
400
396
|
assert response_dict["query"]
|
|
@@ -439,7 +435,7 @@ def test_from_extensions_methods(extensions):
|
|
|
439
435
|
assert hasattr(collection_search, "fields")
|
|
440
436
|
assert hasattr(collection_search, "q")
|
|
441
437
|
assert hasattr(collection_search, "sortby")
|
|
442
|
-
assert hasattr(collection_search, "
|
|
438
|
+
assert hasattr(collection_search, "filter_expr")
|
|
443
439
|
assert ext.conformance_classes == [
|
|
444
440
|
ConformanceClasses.COLLECTIONSEARCH,
|
|
445
441
|
ConformanceClasses.BASIS,
|
|
@@ -463,7 +459,7 @@ def test_from_extensions_methods(extensions):
|
|
|
463
459
|
assert hasattr(collection_search, "fields")
|
|
464
460
|
assert hasattr(collection_search, "q")
|
|
465
461
|
assert hasattr(collection_search, "sortby")
|
|
466
|
-
assert hasattr(collection_search, "
|
|
462
|
+
assert hasattr(collection_search, "filter_expr")
|
|
467
463
|
assert ext.conformance_classes == [
|
|
468
464
|
ConformanceClasses.COLLECTIONSEARCH,
|
|
469
465
|
ConformanceClasses.BASIS,
|
|
@@ -476,35 +472,36 @@ def test_from_extensions_methods(extensions):
|
|
|
476
472
|
|
|
477
473
|
|
|
478
474
|
def test_from_extensions_methods_invalid():
|
|
479
|
-
"""Should
|
|
475
|
+
"""Should also work with unknown extensions."""
|
|
480
476
|
extensions = [
|
|
481
477
|
AggregationExtension(),
|
|
482
478
|
]
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
479
|
+
ext = CollectionSearchExtension.from_extensions(
|
|
480
|
+
extensions,
|
|
481
|
+
)
|
|
482
|
+
|
|
487
483
|
collection_search = ext.GET()
|
|
488
484
|
assert collection_search.__class__.__name__ == "CollectionsGetRequest"
|
|
489
485
|
assert hasattr(collection_search, "bbox")
|
|
490
486
|
assert hasattr(collection_search, "datetime")
|
|
491
487
|
assert hasattr(collection_search, "limit")
|
|
488
|
+
assert hasattr(collection_search, "aggregations")
|
|
492
489
|
assert ext.conformance_classes == [
|
|
493
490
|
ConformanceClasses.COLLECTIONSEARCH,
|
|
494
491
|
ConformanceClasses.BASIS,
|
|
495
492
|
]
|
|
496
493
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
)
|
|
494
|
+
ext = CollectionSearchPostExtension.from_extensions(
|
|
495
|
+
extensions,
|
|
496
|
+
client=DummyPostClient(),
|
|
497
|
+
settings=ApiSettings(),
|
|
498
|
+
)
|
|
503
499
|
collection_search = ext.POST()
|
|
504
500
|
assert collection_search.__class__.__name__ == "CollectionsPostRequest"
|
|
505
501
|
assert hasattr(collection_search, "bbox")
|
|
506
502
|
assert hasattr(collection_search, "datetime")
|
|
507
503
|
assert hasattr(collection_search, "limit")
|
|
504
|
+
assert hasattr(collection_search, "aggregations")
|
|
508
505
|
assert ext.conformance_classes == [
|
|
509
506
|
ConformanceClasses.COLLECTIONSEARCH,
|
|
510
507
|
ConformanceClasses.BASIS,
|
|
@@ -57,6 +57,7 @@ def test_search_filter_post_filter_lang_default(client: TestClient):
|
|
|
57
57
|
)
|
|
58
58
|
assert response.is_success, response.json()
|
|
59
59
|
response_dict = response.json()
|
|
60
|
+
assert response_dict["filter_expr"]
|
|
60
61
|
assert response_dict["filter_lang"] == "cql2-json"
|
|
61
62
|
|
|
62
63
|
|
|
@@ -73,6 +74,7 @@ def test_search_filter_post_filter_lang_non_default(client: TestClient):
|
|
|
73
74
|
)
|
|
74
75
|
assert response.is_success, response.json()
|
|
75
76
|
response_dict = response.json()
|
|
77
|
+
assert response_dict["filter_expr"]
|
|
76
78
|
assert response_dict["filter_lang"] == filter_lang_value
|
|
77
79
|
|
|
78
80
|
|
|
@@ -87,7 +89,7 @@ def test_search_filter_get(client: TestClient):
|
|
|
87
89
|
assert response.is_success, response.json()
|
|
88
90
|
response_dict = response.json()
|
|
89
91
|
assert not response_dict["collections"]
|
|
90
|
-
assert response_dict["
|
|
92
|
+
assert response_dict["filter_expr"] == "id='item_id' AND collection='collection_id'"
|
|
91
93
|
assert not response_dict["filter_crs"]
|
|
92
94
|
assert response_dict["filter_lang"] == "cql2-text"
|
|
93
95
|
|
|
@@ -102,7 +104,7 @@ def test_search_filter_get(client: TestClient):
|
|
|
102
104
|
response_dict = response.json()
|
|
103
105
|
assert not response_dict["collections"]
|
|
104
106
|
assert (
|
|
105
|
-
response_dict["
|
|
107
|
+
response_dict["filter_expr"]
|
|
106
108
|
== "{'op': '=', 'args': [{'property': 'id'}, 'test-item']}"
|
|
107
109
|
)
|
|
108
110
|
assert not response_dict["filter_crs"]
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_extensions-3.0.4 → stac_fastapi_extensions-4.0.0}/stac_fastapi/extensions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|