stac-fastapi-core 6.7.3__tar.gz → 6.7.4__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_core-6.7.3 → stac_fastapi_core-6.7.4}/PKG-INFO +1 -1
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/serializers.py +11 -2
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/utilities.py +17 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/version.py +1 -1
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/.gitignore +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/README.md +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/pyproject.toml +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/pytest.ini +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/__init__.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/base_database_logic.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/base_settings.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/basic_auth.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/core.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/datetime_utils.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/__init__.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/aggregation.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/collections_search.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/fields.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/filter.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/query.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/models/__init__.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/models/links.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/models/search.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/rate_limit.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/redis_utils.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/route_dependencies.py +0 -0
- {stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/session.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stac_fastapi_core
|
|
3
|
-
Version: 6.7.
|
|
3
|
+
Version: 6.7.4
|
|
4
4
|
Summary: Core library for the Elasticsearch and Opensearch stac-fastapi backends.
|
|
5
5
|
Project-URL: Homepage, https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import abc
|
|
4
4
|
import logging
|
|
5
|
+
import os
|
|
5
6
|
from copy import deepcopy
|
|
6
7
|
from typing import Any, List, Optional
|
|
7
8
|
|
|
@@ -10,7 +11,7 @@ from starlette.requests import Request
|
|
|
10
11
|
|
|
11
12
|
from stac_fastapi.core.datetime_utils import now_to_rfc3339_str
|
|
12
13
|
from stac_fastapi.core.models.links import CollectionLinks
|
|
13
|
-
from stac_fastapi.core.utilities import get_bool_env
|
|
14
|
+
from stac_fastapi.core.utilities import get_bool_env, get_excluded_from_items
|
|
14
15
|
from stac_fastapi.types import stac as stac_types
|
|
15
16
|
from stac_fastapi.types.links import ItemLinks, resolve_links
|
|
16
17
|
|
|
@@ -108,7 +109,7 @@ class ItemSerializer(Serializer):
|
|
|
108
109
|
else:
|
|
109
110
|
assets = item.get("assets", {})
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
stac_item = stac_types.Item(
|
|
112
113
|
type="Feature",
|
|
113
114
|
stac_version=item.get("stac_version", ""),
|
|
114
115
|
stac_extensions=item.get("stac_extensions", []),
|
|
@@ -121,6 +122,14 @@ class ItemSerializer(Serializer):
|
|
|
121
122
|
assets=assets,
|
|
122
123
|
)
|
|
123
124
|
|
|
125
|
+
excluded_fields = os.getenv("EXCLUDED_FROM_ITEMS")
|
|
126
|
+
if excluded_fields:
|
|
127
|
+
for field_path in excluded_fields.split(","):
|
|
128
|
+
if field_path := field_path.strip():
|
|
129
|
+
get_excluded_from_items(stac_item, field_path)
|
|
130
|
+
|
|
131
|
+
return stac_item
|
|
132
|
+
|
|
124
133
|
|
|
125
134
|
class CollectionSerializer(Serializer):
|
|
126
135
|
"""Serialization methods for STAC collections."""
|
|
@@ -178,3 +178,20 @@ def dict_deep_update(merge_to: Dict[str, Any], merge_from: Dict[str, Any]) -> No
|
|
|
178
178
|
dict_deep_update(merge_to[k], merge_from[k])
|
|
179
179
|
else:
|
|
180
180
|
merge_to[k] = v
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def get_excluded_from_items(obj: dict, field_path: str) -> None:
|
|
184
|
+
"""Remove a field from items.
|
|
185
|
+
|
|
186
|
+
The field is removed in-place from the dictionary if it exists.
|
|
187
|
+
If any intermediate path does not exist or is not a dictionary,
|
|
188
|
+
the function returns without making any changes.
|
|
189
|
+
"""
|
|
190
|
+
*path, final = field_path.split(".")
|
|
191
|
+
current = obj
|
|
192
|
+
for part in path:
|
|
193
|
+
current = current.get(part, {})
|
|
194
|
+
if not isinstance(current, dict):
|
|
195
|
+
return
|
|
196
|
+
|
|
197
|
+
current.pop(final, None)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "6.7.
|
|
2
|
+
__version__ = "6.7.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/base_database_logic.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/__init__.py
RENAMED
|
File without changes
|
{stac_fastapi_core-6.7.3 → stac_fastapi_core-6.7.4}/stac_fastapi/core/extensions/aggregation.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
|