From e4fce033458cd9d385ffeef0d8f0923d2536b58c Mon Sep 17 00:00:00 2001 From: <> Date: Sat, 4 May 2024 10:32:26 +0000 Subject: [PATCH] Deployed f797ed4 with MkDocs version: 1.6.0 --- .nojekyll | 0 404.html | 1195 +++ api/stac_fastapi/api/app/index.html | 1793 +++++ api/stac_fastapi/api/config/index.html | 1360 ++++ api/stac_fastapi/api/errors/index.html | 1643 ++++ api/stac_fastapi/api/index.html | 1249 +++ api/stac_fastapi/api/middleware/index.html | 1420 ++++ api/stac_fastapi/api/models/index.html | 2711 +++++++ api/stac_fastapi/api/openapi/index.html | 1439 ++++ api/stac_fastapi/api/routes/index.html | 1567 ++++ api/stac_fastapi/api/version/index.html | 1221 +++ .../core/base_database_logic/index.html | 1571 ++++ .../core/base_settings/index.html | 1411 ++++ api/stac_fastapi/core/basic_auth/index.html | 1365 ++++ api/stac_fastapi/core/core/index.html | 3188 ++++++++ .../core/datetime_utils/index.html | 1356 ++++ .../core/extensions/filter/index.html | 4154 ++++++++++ api/stac_fastapi/core/extensions/index.html | 1640 ++++ .../core/extensions/query/index.html | 1549 ++++ api/stac_fastapi/core/index.html | 1309 ++++ api/stac_fastapi/core/models/index.html | 1302 ++++ api/stac_fastapi/core/models/links/index.html | 1865 +++++ .../core/models/search/index.html | 1241 +++ api/stac_fastapi/core/serializers/index.html | 1955 +++++ api/stac_fastapi/core/session/index.html | 1432 ++++ api/stac_fastapi/core/utilities/index.html | 1389 ++++ api/stac_fastapi/core/version/index.html | 1239 +++ api/stac_fastapi/elasticsearch/app/index.html | 2026 +++++ .../elasticsearch/config/index.html | 2352 ++++++ .../elasticsearch/database_logic/index.html | 3430 +++++++++ api/stac_fastapi/elasticsearch/index.html | 1351 ++++ .../elasticsearch/version/index.html | 1239 +++ .../extensions/core/context/index.html | 1376 ++++ .../extensions/core/fields/fields/index.html | 1414 ++++ .../extensions/core/fields/index.html | 1428 ++++ .../extensions/core/fields/request/index.html | 2040 +++++ .../extensions/core/filter/filter/index.html | 1494 ++++ .../extensions/core/filter/index.html | 1425 ++++ .../extensions/core/filter/request/index.html | 1730 +++++ api/stac_fastapi/extensions/core/index.html | 2526 +++++++ .../extensions/core/pagination/index.html | 1521 ++++ .../core/pagination/pagination/index.html | 1376 ++++ .../pagination/token_pagination/index.html | 1376 ++++ .../extensions/core/query/index.html | 1403 ++++ .../extensions/core/query/query/index.html | 1389 ++++ .../extensions/core/query/request/index.html | 1655 ++++ .../extensions/core/sort/index.html | 1389 ++++ .../extensions/core/sort/request/index.html | 1655 ++++ .../extensions/core/sort/sort/index.html | 1375 ++++ .../extensions/core/transaction/index.html | 1696 +++++ api/stac_fastapi/extensions/index.html | 1244 +++ .../third_party/bulk_transactions/index.html | 2007 +++++ .../extensions/third_party/index.html | 1406 ++++ .../extensions/version/index.html | 1221 +++ api/stac_fastapi/index.html | 1246 +++ api/stac_fastapi/opensearch/app/index.html | 2026 +++++ api/stac_fastapi/opensearch/config/index.html | 2352 ++++++ .../opensearch/database_logic/index.html | 3430 +++++++++ api/stac_fastapi/opensearch/index.html | 1351 ++++ .../opensearch/version/index.html | 1239 +++ api/stac_fastapi/types/config/index.html | 1713 +++++ api/stac_fastapi/types/conformance/index.html | 1373 ++++ api/stac_fastapi/types/core/index.html | 3223 ++++++++ api/stac_fastapi/types/errors/index.html | 1719 +++++ api/stac_fastapi/types/extension/index.html | 1392 ++++ api/stac_fastapi/types/index.html | 1252 +++ api/stac_fastapi/types/links/index.html | 1606 ++++ api/stac_fastapi/types/requests/index.html | 1260 ++++ api/stac_fastapi/types/rfc3339/index.html | 1443 ++++ api/stac_fastapi/types/search/index.html | 1675 ++++ api/stac_fastapi/types/stac/index.html | 2847 +++++++ api/stac_fastapi/types/version/index.html | 1221 +++ assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.a7c05c9e.min.js | 29 + assets/javascripts/bundle.a7c05c9e.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.b8dbb3d2.min.js | 42 + .../workers/search.b8dbb3d2.min.js.map | 7 + assets/stylesheets/main.66ac8b77.min.css | 1 + assets/stylesheets/main.66ac8b77.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + contributing/index.html | 1373 ++++ index.html | 1846 +++++ release-notes/index.html | 2190 ++++++ search/search_index.json | 1 + sitemap.xml | 3 + sitemap.xml.gz | Bin 0 -> 127 bytes stylesheets/extra.css | 3 + tips-and-tricks/index.html | 1235 +++ 123 files changed, 134417 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 api/stac_fastapi/api/app/index.html create mode 100644 api/stac_fastapi/api/config/index.html create mode 100644 api/stac_fastapi/api/errors/index.html create mode 100644 api/stac_fastapi/api/index.html create mode 100644 api/stac_fastapi/api/middleware/index.html create mode 100644 api/stac_fastapi/api/models/index.html create mode 100644 api/stac_fastapi/api/openapi/index.html create mode 100644 api/stac_fastapi/api/routes/index.html create mode 100644 api/stac_fastapi/api/version/index.html create mode 100644 api/stac_fastapi/core/base_database_logic/index.html create mode 100644 api/stac_fastapi/core/base_settings/index.html create mode 100644 api/stac_fastapi/core/basic_auth/index.html create mode 100644 api/stac_fastapi/core/core/index.html create mode 100644 api/stac_fastapi/core/datetime_utils/index.html create mode 100644 api/stac_fastapi/core/extensions/filter/index.html create mode 100644 api/stac_fastapi/core/extensions/index.html create mode 100644 api/stac_fastapi/core/extensions/query/index.html create mode 100644 api/stac_fastapi/core/index.html create mode 100644 api/stac_fastapi/core/models/index.html create mode 100644 api/stac_fastapi/core/models/links/index.html create mode 100644 api/stac_fastapi/core/models/search/index.html create mode 100644 api/stac_fastapi/core/serializers/index.html create mode 100644 api/stac_fastapi/core/session/index.html create mode 100644 api/stac_fastapi/core/utilities/index.html create mode 100644 api/stac_fastapi/core/version/index.html create mode 100644 api/stac_fastapi/elasticsearch/app/index.html create mode 100644 api/stac_fastapi/elasticsearch/config/index.html create mode 100644 api/stac_fastapi/elasticsearch/database_logic/index.html create mode 100644 api/stac_fastapi/elasticsearch/index.html create mode 100644 api/stac_fastapi/elasticsearch/version/index.html create mode 100644 api/stac_fastapi/extensions/core/context/index.html create mode 100644 api/stac_fastapi/extensions/core/fields/fields/index.html create mode 100644 api/stac_fastapi/extensions/core/fields/index.html create mode 100644 api/stac_fastapi/extensions/core/fields/request/index.html create mode 100644 api/stac_fastapi/extensions/core/filter/filter/index.html create mode 100644 api/stac_fastapi/extensions/core/filter/index.html create mode 100644 api/stac_fastapi/extensions/core/filter/request/index.html create mode 100644 api/stac_fastapi/extensions/core/index.html create mode 100644 api/stac_fastapi/extensions/core/pagination/index.html create mode 100644 api/stac_fastapi/extensions/core/pagination/pagination/index.html create mode 100644 api/stac_fastapi/extensions/core/pagination/token_pagination/index.html create mode 100644 api/stac_fastapi/extensions/core/query/index.html create mode 100644 api/stac_fastapi/extensions/core/query/query/index.html create mode 100644 api/stac_fastapi/extensions/core/query/request/index.html create mode 100644 api/stac_fastapi/extensions/core/sort/index.html create mode 100644 api/stac_fastapi/extensions/core/sort/request/index.html create mode 100644 api/stac_fastapi/extensions/core/sort/sort/index.html create mode 100644 api/stac_fastapi/extensions/core/transaction/index.html create mode 100644 api/stac_fastapi/extensions/index.html create mode 100644 api/stac_fastapi/extensions/third_party/bulk_transactions/index.html create mode 100644 api/stac_fastapi/extensions/third_party/index.html create mode 100644 api/stac_fastapi/extensions/version/index.html create mode 100644 api/stac_fastapi/index.html create mode 100644 api/stac_fastapi/opensearch/app/index.html create mode 100644 api/stac_fastapi/opensearch/config/index.html create mode 100644 api/stac_fastapi/opensearch/database_logic/index.html create mode 100644 api/stac_fastapi/opensearch/index.html create mode 100644 api/stac_fastapi/opensearch/version/index.html create mode 100644 api/stac_fastapi/types/config/index.html create mode 100644 api/stac_fastapi/types/conformance/index.html create mode 100644 api/stac_fastapi/types/core/index.html create mode 100644 api/stac_fastapi/types/errors/index.html create mode 100644 api/stac_fastapi/types/extension/index.html create mode 100644 api/stac_fastapi/types/index.html create mode 100644 api/stac_fastapi/types/links/index.html create mode 100644 api/stac_fastapi/types/requests/index.html create mode 100644 api/stac_fastapi/types/rfc3339/index.html create mode 100644 api/stac_fastapi/types/search/index.html create mode 100644 api/stac_fastapi/types/stac/index.html create mode 100644 api/stac_fastapi/types/version/index.html create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.a7c05c9e.min.js create mode 100644 assets/javascripts/bundle.a7c05c9e.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js.map create mode 100644 assets/stylesheets/main.66ac8b77.min.css create mode 100644 assets/stylesheets/main.66ac8b77.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 contributing/index.html create mode 100644 index.html create mode 100644 release-notes/index.html create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 stylesheets/extra.css create mode 100644 tips-and-tricks/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..d0e9dc1d --- /dev/null +++ b/404.html @@ -0,0 +1,1195 @@ + + + +
+ + + + + + + + + + + + + + + + +Fastapi app creation.
+DEFAULT_STATUS_CODES
+
STAC_VERSION
+
class StacApi(
+ settings: stac_fastapi.types.config.ApiSettings,
+ client: Union[stac_fastapi.types.core.AsyncBaseCoreClient, stac_fastapi.types.core.BaseCoreClient],
+ extensions: List[stac_fastapi.types.extension.ApiExtension] = NOTHING,
+ exceptions: Dict[Type[Exception], int] = NOTHING,
+ app: fastapi.applications.FastAPI = NOTHING,
+ router: fastapi.routing.APIRouter = NOTHING,
+ title: str = NOTHING,
+ api_version: str = NOTHING,
+ stac_version: str = '1.0.0',
+ description: str = NOTHING,
+ search_get_request_model: Type[stac_fastapi.types.search.BaseSearchGetRequest] = <class 'stac_fastapi.types.search.BaseSearchGetRequest'>,
+ search_post_request_model: Type[stac_fastapi.types.search.BaseSearchPostRequest] = <class 'stac_fastapi.types.search.BaseSearchPostRequest'>,
+ pagination_extension=<class 'stac_fastapi.extensions.core.pagination.token_pagination.TokenPaginationExtension'>,
+ response_class: Type[starlette.responses.Response] = <class 'starlette.responses.JSONResponse'>,
+ middlewares: List = NOTHING,
+ route_dependencies: List[Tuple[List[stac_fastapi.api.routes.Scope], List[fastapi.params.Depends]]] = []
+)
+
StacApi factory.
+Factory for creating a STAC-compliant FastAPI application. After
+instantation, the application is accessible from the StacApi.app
attribute.
Name | +Type | +Description | +Default | +
---|---|---|---|
settings | +None | +API settings and configuration, potentially using environment variables. See pydantic-docs.helpmanual.io/usage/settings/. |
+None | +
client | +None | +A subclass of stac_api.clients.BaseCoreClient . Defines theapplication logic which is injected into the API. |
+None | +
extensions | +None | +API extensions to include with the application. This may include official STAC extensions as well as third-party add ons. |
+None | +
exceptions | +None | +Defines a global mapping between exceptions and status codes, allowing configuration of response behavior on certain exceptions (fastapi.tiangolo.com/tutorial/handling-errors/#install-custom-exception-handlers). |
+None | +
app | +None | +The FastAPI application, defaults to a fresh application. | +None | +
route_dependencies | +None | +List of tuples of route scope dicts (eg {'path':<br>'/collections', 'method': 'POST'} ) and list of dependencies (e.g.[Depends(oauth2_scheme)] )). Applies specified dependencies tospecified routes. This is useful for applying custom auth requirements to routes defined elsewhere in the application. |
+None | +
pagination_extension
+
def add_health_check(
+ self
+)
+
Add a health check.
+def add_route_dependencies(
+ self,
+ scopes: List[stac_fastapi.api.routes.Scope],
+ dependencies=typing.List[fastapi.params.Depends]
+) -> None
+
Add custom dependencies to routes.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
scopes | +None | +list of scopes. Each scope should be a dict with a path and method property. |
+None | +
dependencies | +None | +list of FastAPI dependencies to apply to each scope. |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
def customize_openapi(
+ self
+) -> Union[Dict[str, Any], NoneType]
+
Customize openapi schema.
+def get_extension(
+ self,
+ extension: Type[stac_fastapi.types.extension.ApiExtension]
+) -> Union[stac_fastapi.types.extension.ApiExtension, NoneType]
+
Get an extension.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
extension | +None | +extension to check for. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The extension instance, if it exists. | +
def register_conformance_classes(
+ self
+)
+
Register conformance classes (GET /conformance).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_core(
+ self
+)
+
Register core STAC endpoints.
+GET / + GET /conformance + GET /collections + GET /collections/{collection_id} + GET /collections/{collection_id}/items + GET /collection/{collection_id}/items/{item_id} + GET /search + POST /search
+Injects application logic (StacApi.client) into the API layer.
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_get_collection(
+ self
+)
+
Register get collection endpoint (GET /collection/{collection_id}).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_get_collections(
+ self
+)
+
Register get collections endpoint (GET /collections).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_get_item(
+ self
+)
+
Register get item endpoint (GET /collections/{collection_id}/items/{item_id}).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_get_item_collection(
+ self
+)
+
Register get item collection endpoint (GET /collection/{collection_id}/items).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_get_search(
+ self
+)
+
Register search endpoint (GET /search).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_landing_page(
+ self
+)
+
Register landing page (GET /).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_post_search(
+ self
+)
+
Register search endpoint (POST /search).
+Returns:
+Type | +Description | +
---|---|
None | +None | +
Application settings.
+class AddOns(
+ /,
+ *args,
+ **kwargs
+)
+
Enumeration of available third party add ons.
+bulk_transaction
+
name
+
value
+
class ApiExtensions(
+ /,
+ *args,
+ **kwargs
+)
+
Enumeration of available stac api extensions.
+Ref: @stac-api-extensions
+context
+
fields
+
filter
+
name
+
query
+
sort
+
transaction
+
value
+
Error handling.
+DEFAULT_STATUS_CODES
+
logger
+
def add_exception_handlers(
+ app: fastapi.applications.FastAPI,
+ status_codes: Dict[Type[Exception], int]
+) -> None
+
Add exception handlers to the FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +the FastAPI application. | +None | +
status_codes | +None | +mapping between exceptions and status codes. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
def exception_handler_factory(
+ status_code: int
+) -> Callable
+
Create a FastAPI exception handler for a particular status code.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
status_code | +None | +HTTP status code. | +None | +
Returns:
+Type | +Description | +
---|---|
callable | +an exception handler. | +
class ErrorResponse(
+ /,
+ *args,
+ **kwargs
+)
+
A JSON error response returned by the API.
+The STAC API spec expects that code
and description
are both present in
+the payload.
Name | +Type | +Description | +Default | +
---|---|---|---|
code | +None | +A code representing the error, semantics are up to implementor. | +None | +
description | +None | +A description of the error. | +None | +
def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+ + + + + + + + + + + + + +Api middleware.
+HTTPS_PORT
+
HTTP_PORT
+
class CORSMiddleware(
+ app: Callable[[MutableMapping[str, Any], Callable[[], Awaitable[MutableMapping[str, Any]]], Callable[[MutableMapping[str, Any]], Awaitable[NoneType]]], Awaitable[NoneType]],
+ allow_origins: Sequence[str] = ('*',),
+ allow_methods: Sequence[str] = ('OPTIONS', 'POST', 'GET'),
+ allow_headers: Sequence[str] = ('Content-Type',),
+ allow_credentials: bool = False,
+ allow_origin_regex: Union[str, NoneType] = None,
+ expose_headers: Sequence[str] = (),
+ max_age: int = 600
+)
+
Subclass of Starlette's standard CORS middleware with default values set to those
+recommended by the STAC API spec.
+ +def allow_explicit_origin(
+ headers: starlette.datastructures.MutableHeaders,
+ origin: str
+) -> None
+
def is_allowed_origin(
+ self,
+ origin: str
+) -> bool
+
def preflight_response(
+ self,
+ request_headers: starlette.datastructures.Headers
+) -> starlette.responses.Response
+
def send(
+ self,
+ message: MutableMapping[str, Any],
+ send: Callable[[MutableMapping[str, Any]], Awaitable[NoneType]],
+ request_headers: starlette.datastructures.Headers
+) -> None
+
def simple_response(
+ self,
+ scope: MutableMapping[str, Any],
+ receive: Callable[[], Awaitable[MutableMapping[str, Any]]],
+ send: Callable[[MutableMapping[str, Any]], Awaitable[NoneType]],
+ request_headers: starlette.datastructures.Headers
+) -> None
+
class ProxyHeaderMiddleware(
+ app: Callable[[MutableMapping[str, Any], Callable[[], Awaitable[MutableMapping[str, Any]]], Callable[[MutableMapping[str, Any]], Awaitable[NoneType]]], Awaitable[NoneType]]
+)
+
Account for forwarding headers when deriving base URL.
+Prioritise standard Forwarded header, look for non-standard X-Forwarded-* if missing. +Default to what can be derived from the URL if no headers provided. Middleware updates +the host header that is interpreted by starlette when deriving Request.base_url.
+ + + + + + + + + + + + + +Api request/response models.
+def create_get_request_model(
+ extensions,
+ base_model: stac_fastapi.types.search.BaseSearchGetRequest = <class 'stac_fastapi.types.search.BaseSearchGetRequest'>
+)
+
Wrap create_request_model to create the GET request model.
+def create_post_request_model(
+ extensions,
+ base_model: stac_fastapi.types.search.BaseSearchPostRequest = <class 'stac_fastapi.types.search.BaseSearchPostRequest'>
+)
+
Wrap create_request_model to create the POST request model.
+def create_request_model(
+ model_name='SearchGetRequest',
+ base_model: Union[Type[pydantic.main.BaseModel], stac_fastapi.types.search.APIRequest] = <class 'stac_fastapi.types.search.BaseSearchGetRequest'>,
+ extensions: Union[stac_fastapi.types.extension.ApiExtension, NoneType] = None,
+ mixins: Union[pydantic.main.BaseModel, stac_fastapi.types.search.APIRequest, NoneType] = None,
+ request_type: Union[str, NoneType] = 'GET'
+) -> Union[Type[pydantic.main.BaseModel], stac_fastapi.types.search.APIRequest]
+
Create a pydantic model for validating request bodies.
+class CollectionUri(
+ collection_id: str = Path(Ellipsis)
+)
+
Get or delete collection.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class EmptyRequest(
+
+)
+
Empty request.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class GETPagination(
+ page: Union[str, NoneType] = None
+)
+
Page based pagination for GET requests.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class GETTokenPagination(
+ token: Union[str, NoneType] = None
+)
+
Token pagination for GET requests.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class GeoJSONResponse(
+ content: Any,
+ status_code: int = 200,
+ headers: Union[Dict[str, str], NoneType] = None,
+ media_type: Union[str, NoneType] = None,
+ background: Union[starlette.background.BackgroundTask, NoneType] = None
+)
+
JSON with custom, vendor content-type.
+charset
+
media_type
+
headers
+
def delete_cookie(
+ self,
+ key: str,
+ path: str = '/',
+ domain: Union[str, NoneType] = None,
+ secure: bool = False,
+ httponly: bool = False,
+ samesite: Union[Literal['lax', 'strict', 'none'], NoneType] = 'lax'
+) -> None
+
def init_headers(
+ self,
+ headers: Union[Mapping[str, str], NoneType] = None
+) -> None
+
def render(
+ self,
+ content: Any
+) -> bytes
+
def set_cookie(
+ self,
+ key: str,
+ value: str = '',
+ max_age: Union[int, NoneType] = None,
+ expires: Union[datetime.datetime, str, int, NoneType] = None,
+ path: str = '/',
+ domain: Union[str, NoneType] = None,
+ secure: bool = False,
+ httponly: bool = False,
+ samesite: Union[Literal['lax', 'strict', 'none'], NoneType] = 'lax'
+) -> None
+
class ItemCollectionUri(
+ collection_id: str = Path(Ellipsis),
+ limit: int = 10,
+ bbox: str = None,
+ datetime: Union[str, NoneType] = None
+)
+
Get item collection.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class ItemUri(
+ collection_id: str = Path(Ellipsis),
+ item_id: str = Path(Ellipsis)
+)
+
Get or delete item.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class JSONSchemaResponse(
+ content: Any,
+ status_code: int = 200,
+ headers: Union[Dict[str, str], NoneType] = None,
+ media_type: Union[str, NoneType] = None,
+ background: Union[starlette.background.BackgroundTask, NoneType] = None
+)
+
JSON with custom, vendor content-type.
+charset
+
media_type
+
headers
+
def delete_cookie(
+ self,
+ key: str,
+ path: str = '/',
+ domain: Union[str, NoneType] = None,
+ secure: bool = False,
+ httponly: bool = False,
+ samesite: Union[Literal['lax', 'strict', 'none'], NoneType] = 'lax'
+) -> None
+
def init_headers(
+ self,
+ headers: Union[Mapping[str, str], NoneType] = None
+) -> None
+
def render(
+ self,
+ content: Any
+) -> bytes
+
def set_cookie(
+ self,
+ key: str,
+ value: str = '',
+ max_age: Union[int, NoneType] = None,
+ expires: Union[datetime.datetime, str, int, NoneType] = None,
+ path: str = '/',
+ domain: Union[str, NoneType] = None,
+ secure: bool = False,
+ httponly: bool = False,
+ samesite: Union[Literal['lax', 'strict', 'none'], NoneType] = 'lax'
+) -> None
+
class POSTPagination(
+ __pydantic_self__,
+ **data: Any
+)
+
Page based pagination for POST requests.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class POSTTokenPagination(
+ __pydantic_self__,
+ **data: Any
+)
+
Token pagination model for POST requests.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
openapi.
+def config_openapi(
+ app: fastapi.applications.FastAPI,
+ settings: stac_fastapi.types.config.ApiSettings
+)
+
Config openapi.
+def update_openapi(
+ app: fastapi.applications.FastAPI
+) -> fastapi.applications.FastAPI
+
Update OpenAPI response content-type.
+This function modifies the openapi route to comply with the STAC API spec's required +content-type response header.
+class VndOaiResponse(
+ *args,
+ **kwargs
+)
+
JSON with custom, vendor content-type.
+charset
+
media_type
+
headers
+
def delete_cookie(
+ self,
+ key: str,
+ path: str = '/',
+ domain: Union[str, NoneType] = None,
+ secure: bool = False,
+ httponly: bool = False,
+ samesite: Union[Literal['lax', 'strict', 'none'], NoneType] = 'lax'
+) -> None
+
def init_headers(
+ self,
+ headers: Union[Mapping[str, str], NoneType] = None
+) -> None
+
def render(
+ self,
+ content: Any
+) -> bytes
+
def set_cookie(
+ self,
+ key: str,
+ value: str = '',
+ max_age: Union[int, NoneType] = None,
+ expires: Union[datetime.datetime, str, int, NoneType] = None,
+ path: str = '/',
+ domain: Union[str, NoneType] = None,
+ secure: bool = False,
+ httponly: bool = False,
+ samesite: Union[Literal['lax', 'strict', 'none'], NoneType] = 'lax'
+) -> None
+
Route factories.
+HTTP_204_NO_CONTENT
+
def add_route_dependencies(
+ routes: List[starlette.routing.BaseRoute],
+ scopes: List[stac_fastapi.api.routes.Scope],
+ dependencies=typing.List[fastapi.params.Depends]
+) -> None
+
Add dependencies to routes.
+Allows a developer to add dependencies to a route after the route has been +defined.
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def create_async_endpoint(
+ func: Callable,
+ request_model: Union[Type[stac_fastapi.types.search.APIRequest], Type[pydantic.main.BaseModel], Dict],
+ response_class: Union[Type[starlette.responses.Response], NoneType] = None
+)
+
Wrap a function in a coroutine which may be used to create a FastAPI endpoint.
+Synchronous functions are executed asynchronously using a background thread.
+def sync_to_async(
+ func
+)
+
Run synchronous function asynchronously in a background thread.
+class Scope(
+ /,
+ *args,
+ **kwargs
+)
+
More strict version of Starlette's Scope.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+ + + + + + + + + + + + + +Library version.
+ + + + + + + + + + + + + +Base database logic.
+class BaseDatabaseLogic(
+ /,
+ *args,
+ **kwargs
+)
+
Abstract base class for database logic.
+This class defines the basic structure and operations for database interactions. +Subclasses must provide implementations for these methods.
+def create_collection(
+ self,
+ collection: Dict,
+ refresh: bool = False
+) -> None
+
Create a collection in the database.
+def create_item(
+ self,
+ item: Dict,
+ refresh: bool = False
+) -> None
+
Create an item in the database.
+def delete_collection(
+ self,
+ collection_id: str,
+ refresh: bool = False
+) -> None
+
Delete a collection from the database.
+def delete_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ refresh: bool = False
+) -> None
+
Delete an item from the database.
+def find_collection(
+ self,
+ collection_id: str
+) -> Dict
+
Find a collection in the database.
+def get_all_collections(
+ self,
+ token: Union[str, NoneType],
+ limit: int
+) -> Iterable[Dict[str, Any]]
+
Retrieve a list of all collections from the database.
+def get_one_item(
+ self,
+ collection_id: str,
+ item_id: str
+) -> Dict
+
Retrieve a single item from the database.
+ + + + + + + + + + + + + +Base settings.
+class ApiBaseSettings(
+ /,
+ *args,
+ **kwargs
+)
+
Abstract base class for API settings.
+def create_client(
+ self
+)
+
Create a database client.
+ + + + + + + + + + + + + +Basic Authentication Module.
+def apply_basic_auth(
+ api: stac_fastapi.api.app.StacApi
+) -> None
+
Apply basic authentication to the provided FastAPI application based on environment variables for username, password, and endpoints.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
api | +StacApi | +The FastAPI application. | +None | +
Raises:
+Type | +Description | +
---|---|
HTTPException | +If there are issues with the configuration or format of the environment variables. |
+
def has_access(
+ request: starlette.requests.Request,
+ credentials: typing_extensions.Annotated[fastapi.security.http.HTTPBasicCredentials, Depends(HTTPBasic)]
+) -> str
+
Check if the provided credentials match the expected username and password stored in environment variables for basic authentication.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
request | +Request | +The FastAPI request object. | +None | +
credentials | +HTTPBasicCredentials | +The HTTP basic authentication credentials. | +None | +
Returns:
+Type | +Description | +
---|---|
str | +The username if authentication is successful. | +
Raises:
+Type | +Description | +
---|---|
HTTPException | +If authentication fails due to incorrect username or password. | +
Core client.
+BASE_CONFORMANCE_CLASSES
+
NumType
+
STAC_VERSION
+
logger
+
class BulkTransactionsClient(
+ database: stac_fastapi.core.base_database_logic.BaseDatabaseLogic,
+ settings: stac_fastapi.core.base_settings.ApiBaseSettings,
+ session: stac_fastapi.core.session.Session = NOTHING
+)
+
A client for posting bulk transactions to a Postgres database.
+Name | +Type | +Description | +Default | +
---|---|---|---|
session | +None | +An instance of Session to use for database connection. |
+None | +
database | +None | +An instance of DatabaseLogic to perform database operations. |
+None | +
def bulk_item_insert(
+ self,
+ items: stac_fastapi.extensions.third_party.bulk_transactions.Items,
+ chunk_size: Union[int, NoneType] = None,
+ **kwargs
+) -> str
+
Perform a bulk insertion of items into the database using Elasticsearch.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
items | +None | +The items to insert. | +None | +
chunk_size | +None | +The size of each chunk for bulk processing. | +None | +
**kwargs | +None | +Additional keyword arguments, such as request and refresh . |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +A string indicating the number of items successfully added. | +
def preprocess_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ base_url,
+ method: stac_fastapi.extensions.third_party.bulk_transactions.BulkTransactionMethod
+) -> stac_fastapi.types.stac.Item
+
Preprocess an item to match the data model.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +None | +The item to preprocess. | +None | +
base_url | +None | +The base URL of the request. | +None | +
method | +None | +The bulk transaction method. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The preprocessed item. | +
class CoreClient(
+ database: stac_fastapi.core.base_database_logic.BaseDatabaseLogic,
+ base_conformance_classes: List[str] = NOTHING,
+ extensions: List[stac_fastapi.types.extension.ApiExtension] = NOTHING,
+ session: stac_fastapi.core.session.Session = NOTHING,
+ item_serializer: Type[stac_fastapi.core.serializers.ItemSerializer] = <class 'stac_fastapi.core.serializers.ItemSerializer'>,
+ collection_serializer: Type[stac_fastapi.core.serializers.CollectionSerializer] = <class 'stac_fastapi.core.serializers.CollectionSerializer'>,
+ post_request_model=<class 'stac_fastapi.types.search.BaseSearchPostRequest'>,
+ stac_version: str = '1.0.0',
+ landing_page_id: str = 'stac-fastapi',
+ title: str = 'stac-fastapi',
+ description: str = 'stac-fastapi'
+)
+
Client for core endpoints defined by the STAC specification.
+This class is a implementation of AsyncBaseCoreClient
that implements the core endpoints
+defined by the STAC specification. It uses the DatabaseLogic
class to interact with the
+database, and ItemSerializer
and CollectionSerializer
to convert between STAC objects and
+database records.
Name | +Type | +Description | +Default | +
---|---|---|---|
session | +Session | +A requests session instance to be used for all HTTP requests. | +None | +
item_serializer | +Type[serializers.ItemSerializer] | +A serializer class to be used to convert between STAC items and database records. |
+None | +
collection_serializer | +Type[serializers.CollectionSerializer] | +A serializer class to be used to convert between STAC collections and database records. |
+None | +
database | +DatabaseLogic | +An instance of the DatabaseLogic class that is used to interactwith the database. |
+None | +
post_request_model
+
def all_collections(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.Collections
+
Read all collections from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
**kwargs | +None | +Keyword arguments from the request. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +A Collections object containing all the collections in the database and links to various resources. | +
def conformance(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.Conformance
+
Conformance classes.
+Called with GET /conformance
.
Returns:
+Type | +Description | +
---|---|
None | +Conformance classes which the server conforms to. | +
def conformance_classes(
+ self
+) -> List[str]
+
Generate conformance classes.
+def extension_is_enabled(
+ self,
+ extension: str
+) -> bool
+
Check if an api extension is enabled.
+def get_collection(
+ self,
+ collection_id: str,
+ **kwargs
+) -> stac_fastapi.types.stac.Collection
+
Get a collection from the database by its id.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The id of the collection to retrieve. | +None | +
kwargs | +None | +Additional keyword arguments passed to the API call. | +None | +
Returns:
+Type | +Description | +
---|---|
Collection | +A Collection object representing the requested collection. |
+
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection with the given id cannot be found in the database. | +
def get_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ **kwargs
+) -> stac_fastapi.types.stac.Item
+
Get an item from the database based on its id and collection id.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The ID of the collection the item belongs to. | +None | +
item_id | +str | +The ID of the item to be retrieved. | +None | +
Returns:
+Type | +Description | +
---|---|
Item | +An Item object representing the requested item. |
+
Raises:
+Type | +Description | +
---|---|
Exception | +If any error occurs while getting the item from the database. | +
NotFoundError | +If the item does not exist in the specified collection. | +
def get_search(
+ self,
+ request: starlette.requests.Request,
+ collections: Union[List[str], NoneType] = None,
+ ids: Union[List[str], NoneType] = None,
+ bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
+ datetime: Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType] = None,
+ limit: Union[int, NoneType] = 10,
+ query: Union[str, NoneType] = None,
+ token: Union[str, NoneType] = None,
+ fields: Union[List[str], NoneType] = None,
+ sortby: Union[str, NoneType] = None,
+ intersects: Union[str, NoneType] = None,
+ filter: Union[str, NoneType] = None,
+ filter_lang: Union[str, NoneType] = None,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Get search results from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collections | +Optional[List[str]] | +List of collection IDs to search in. | +None | +
ids | +Optional[List[str]] | +List of item IDs to search for. | +None | +
bbox | +Optional[BBox] | +Bounding box to search in. | +None | +
datetime | +Optional[DateTimeType] | +Filter items based on the datetime field. | +None | +
limit | +Optional[int] | +Maximum number of results to return. | +None | +
query | +Optional[str] | +Query string to filter the results. | +None | +
token | +Optional[str] | +Access token to use when searching the catalog. | +None | +
fields | +Optional[List[str]] | +Fields to include or exclude from the results. | +None | +
sortby | +Optional[str] | +Sorting options for the results. | +None | +
intersects | +Optional[str] | +GeoJSON geometry to search in. | +None | +
kwargs | +None | +Additional parameters to be passed to the API. | +None | +
Returns:
+Type | +Description | +
---|---|
ItemCollection | +Collection of Item objects representing the search results. |
+
Raises:
+Type | +Description | +
---|---|
HTTPException | +If any error occurs while searching the catalog. | +
def item_collection(
+ self,
+ collection_id: str,
+ bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
+ datetime: Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType] = None,
+ limit: int = 10,
+ token: str = None,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Read items from a specific collection in the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The identifier of the collection to read items from. | +None | +
bbox | +Optional[BBox] | +The bounding box to filter items by. | +None | +
datetime | +Optional[DateTimeType] | +The datetime range to filter items by. | +None | +
limit | +int | +The maximum number of items to return. The default value is 10. | +None | +
token | +str | +A token used for pagination. | +None | +
request | +Request | +The incoming request. | +None | +
Returns:
+Type | +Description | +
---|---|
ItemCollection | +An ItemCollection object containing the items from the specified collection that meetthe filter criteria and links to various resources. |
+
Raises:
+Type | +Description | +
---|---|
HTTPException | +If the specified collection is not found. | +
Exception | +If any error occurs while reading the items from the database. | +
def landing_page(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.LandingPage
+
Landing page.
+Called with GET /
.
Returns:
+Type | +Description | +
---|---|
None | +API landing page, serving as an entry point to the API. | +
def post_search(
+ self,
+ search_request: stac_fastapi.types.search.BaseSearchPostRequest,
+ request: starlette.requests.Request
+) -> stac_fastapi.types.stac.ItemCollection
+
Perform a POST search on the catalog.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search_request | +BaseSearchPostRequest | +Request object that includes the parameters for the search. | +None | +
kwargs | +None | +Keyword arguments passed to the function. | +None | +
Returns:
+Type | +Description | +
---|---|
ItemCollection | +A collection of items matching the search criteria. | +
Raises:
+Type | +Description | +
---|---|
HTTPException | +If there is an error with the cql2_json filter. | +
class EsAsyncBaseFiltersClient(
+
+)
+
Defines a pattern for implementing the STAC filter extension.
+def get_queryables(
+ self,
+ collection_id: Union[str, NoneType] = None,
+ **kwargs
+) -> Dict[str, Any]
+
Get the queryables available for the given collection_id.
+If collection_id is None, returns the intersection of all +queryables over all collections.
+This base implementation returns a blank queryable schema. This is not allowed +under OGC CQL but it is allowed by the STAC API Filter Extension
+github.com/radiantearth/stac-api-spec/tree/master/fragments/filter#queryables
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The id of the collection to get queryables for. | +None | +
**kwargs | +None | +additional keyword arguments | +None | +
Returns:
+Type | +Description | +
---|---|
Dict[str, Any] | +A dictionary containing the queryables for the given collection. | +
class TransactionsClient(
+ database: stac_fastapi.core.base_database_logic.BaseDatabaseLogic,
+ settings: stac_fastapi.core.base_settings.ApiBaseSettings,
+ session: stac_fastapi.core.session.Session = NOTHING
+)
+
Transactions extension specific CRUD operations.
+def create_collection(
+ self,
+ collection: stac_fastapi.types.stac.Collection,
+ **kwargs
+) -> stac_fastapi.types.stac.Collection
+
Create a new collection in the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +stac_types.Collection | +The collection to be created. | +None | +
kwargs | +None | +Additional keyword arguments. | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Collection | +The created collection object. | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If the collection already exists. | +
def create_item(
+ self,
+ collection_id: str,
+ item: stac_fastapi.types.stac.Item,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, NoneType]
+
Create an item in the collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The id of the collection to add the item to. | +None | +
item | +stac_types.Item | +The item to be added to the collection. | +None | +
kwargs | +None | +Additional keyword arguments. | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Item | +The created item. | +
Raises:
+Type | +Description | +
---|---|
NotFound | +If the specified collection is not found in the database. | +
ConflictError | +If the item in the specified collection already exists. | +
def delete_collection(
+ self,
+ collection_id: str,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, NoneType]
+
Delete a collection.
+This method deletes an existing collection in the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The identifier of the collection that contains the item. | +None | +
kwargs | +None | +Additional keyword arguments. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None. | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection doesn't exist. | +
def delete_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, NoneType]
+
Delete an item from a collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +str | +The identifier of the item to delete. | +None | +
collection_id | +str | +The identifier of the collection that contains the item. | +None | +
Returns:
+Type | +Description | +
---|---|
Optional[stac_types.Item] | +The deleted item, or None if the item was successfully deleted. |
+
def update_collection(
+ self,
+ collection: stac_fastapi.types.stac.Collection,
+ **kwargs
+) -> stac_fastapi.types.stac.Collection
+
Update a collection.
+This method updates an existing collection in the database by first finding
+the collection by the id given in the keyword argument collection_id
.
+If no collection_id
is given the id of the given collection object is used.
+If the object and keyword collection ids don't match the sub items
+collection id is updated else the items are left unchanged.
+The updated collection is then returned.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +None | +A STAC collection that needs to be updated. | +None | +
kwargs | +None | +Additional keyword arguments. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +A STAC collection that has been updated in the database. | +
def update_item(
+ self,
+ collection_id: str,
+ item_id: str,
+ item: stac_fastapi.types.stac.Item,
+ **kwargs
+) -> stac_fastapi.types.stac.Item
+
Update an item in the collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The ID of the collection the item belongs to. | +None | +
item_id | +str | +The ID of the item to be updated. | +None | +
item | +stac_types.Item | +The new item data. | +None | +
kwargs | +None | +Other optional arguments, including the request object. | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Item | +The updated item object. | +
Raises:
+Type | +Description | +
---|---|
NotFound | +If the specified collection is not found in the database. | +
A few datetime methods.
+def now_in_utc(
+
+) -> datetime.datetime
+
Return a datetime value of now with the UTC timezone applied.
+def now_to_rfc3339_str(
+
+) -> str
+
Return an RFC 3339 string representing now.
+ + + + + + + + + + + + + +Implements Filter Extension.
+Basic CQL2 (AND, OR, NOT), comparison operators (=, <>, <, <=, >, >=), and IS NULL. +The comparison operators are allowed against string, numeric, boolean, date, and datetime types.
+Advanced comparison operators (www.opengis.net/spec/cql2/1.0/req/advanced-comparison-operators) +defines the LIKE, IN, and BETWEEN operators.
+Basic Spatial Operators (www.opengis.net/spec/cql2/1.0/conf/basic-spatial-operators) +defines the intersects operator (S_INTERSECTS).
+Arg
+
queryables_mapping
+
def cql2_like_to_es(
+ string
+)
+
Convert wildcard characters in CQL2 ('_' and '%') to Elasticsearch wildcard characters ('?' and '*', respectively). Handle escape characters and pass through Elasticsearch wildcards.
+def to_es(
+ arg: 'Arg'
+)
+
Generate an Elasticsearch expression for this Arg.
+class AdvancedComparisonOp(
+ /,
+ *args,
+ **kwargs
+)
+
Advanced Comparison operator.
+CQL2 advanced comparison operators like (~), between, and in.
+between
+
like
+
name
+
value
+
class Clause(
+ __pydantic_self__,
+ **data: Any
+)
+
Filter extension clause.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
def to_es(
+ self
+)
+
Generate an Elasticsearch expression for this Clause.
+class ComparisonOp(
+ /,
+ *args,
+ **kwargs
+)
+
Comparison operator.
+CQL2 comparison operators =, <>, <, <=, >, >=, and isNull.
+eq
+
gt
+
gte
+
is_null
+
lt
+
lte
+
name
+
neq
+
value
+
class Date(
+ __pydantic_self__,
+ **data: Any
+)
+
Representation of an ISO 8601 date value object.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
def to_es(
+ self
+)
+
Produce an ISO 8601 date string.
+class FloatInt(
+ /,
+ *args,
+ **kwargs
+)
+
Representation of Float/Int.
+imag
+
real
+
def validate(
+ v
+)
+
Validate input value.
+def as_integer_ratio(
+ self,
+ /
+)
+
Return integer ratio.
+Return a pair of integers, whose ratio is exactly equal to the original float +and with a positive denominator.
+Raise OverflowError on infinities and a ValueError on NaNs.
+++++++(10.0).as_integer_ratio() +(10, 1) +(0.0).as_integer_ratio() +(0, 1) +(-.25).as_integer_ratio() +(-1, 4)
+
def conjugate(
+ self,
+ /
+)
+
Return self, the complex conjugate of any float.
+def fromhex(
+ string,
+ /
+)
+
Create a floating-point number from a hexadecimal string.
+++++++float.fromhex('0x1.ffffp10') +2047.984375 +float.fromhex('-0x1p-1074') +-5e-324
+
def hex(
+ self,
+ /
+)
+
Return a hexadecimal representation of a floating-point number.
+++++++(-0.1).hex() +'-0x1.999999999999ap-4' +3.14159.hex() +'0x1.921f9f01b866ep+1'
+
def is_integer(
+ self,
+ /
+)
+
Return True if the float is an integer.
+class LogicalOp(
+ /,
+ *args,
+ **kwargs
+)
+
Logical operator.
+CQL2 logical operators and, or, and not.
+name
+
value
+
class PropertyReference(
+ __pydantic_self__,
+ **data: Any
+)
+
Property reference.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
def to_es(
+ self
+)
+
Produce a term value for this, possibly mapped by a queryable.
+class SpatialIntersectsOp(
+ /,
+ *args,
+ **kwargs
+)
+
Spatial intersections operator s_intersects.
+name
+
s_intersects
+
value
+
class Timestamp(
+ __pydantic_self__,
+ **data: Any
+)
+
Representation of an RFC 3339 datetime value object.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
def to_es(
+ self
+)
+
Produce an RFC 3339 datetime string.
+ + + + + + + + + + + + + +elasticsearch extensions modifications.
+class Operator(
+ /,
+ *args,
+ **kwargs
+)
+
Defines the set of operators supported by the API.
+eq
+
gt
+
gte
+
lt
+
lte
+
ne
+
class QueryExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Query Extenson.
+Override the POST request model to add validation against +supported fields
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class QueryableTypes(
+
+)
+
Defines a set of queryable fields.
+ + + + + + + + + + + + + +STAC SQLAlchemy specific query search model.
+NumType
+
logger
+
class Operator(
+ /,
+ *args,
+ **kwargs
+)
+
Defines the set of operators supported by the API.
+eq
+
gt
+
gte
+
lt
+
lte
+
ne
+
class QueryExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Query Extenson.
+Override the POST request model to add validation against +supported fields
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class QueryExtensionPostRequest(
+ __pydantic_self__,
+ **data: Any
+)
+
Queryable validation.
+Add queryables validation to the POST request +to raise errors for unsupported querys.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def validate_query_fields(
+ values: Dict
+) -> Dict
+
Validate query fields.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class QueryableTypes(
+
+)
+
Defines a set of queryable fields.
+class Queryables(
+ /,
+ *args,
+ **kwargs
+)
+
Queryable fields.
+Core library.
+link helpers.
+INFERRED_LINK_RELS
+
def merge_params(
+ url: str,
+ newparams: Dict
+) -> str
+
Merge url parameters.
+class BaseLinks(
+ request: starlette.requests.Request
+)
+
Create inferred links common to collections and items.
+base_url
+
Get the base url.
+url
+
Get the current request url.
+def create_links(
+ self
+) -> List[Dict[str, Any]]
+
Return all inferred links.
+def get_links(
+ self,
+ extra_links: Union[List[Dict[str, Any]], NoneType] = None
+) -> List[Dict[str, Any]]
+
Generate all the links.
+Get the links object for a stac resource by iterating through +available methods on this class that start with link_.
+def link_root(
+ self
+) -> Dict
+
Return the catalog root.
+def link_self(
+ self
+) -> Dict
+
Return the self link.
+def resolve(
+ self,
+ url
+)
+
Resolve url to the current request url.
+class PagingLinks(
+ request: starlette.requests.Request,
+ *,
+ next: Union[str, NoneType] = None
+)
+
Create links for paging.
+base_url
+
Get the base url.
+url
+
Get the current request url.
+def create_links(
+ self
+) -> List[Dict[str, Any]]
+
Return all inferred links.
+def get_links(
+ self,
+ extra_links: Union[List[Dict[str, Any]], NoneType] = None
+) -> List[Dict[str, Any]]
+
Generate all the links.
+Get the links object for a stac resource by iterating through +available methods on this class that start with link_.
+def link_next(
+ self
+) -> Union[Dict[str, Any], NoneType]
+
Create link for next page.
+def link_root(
+ self
+) -> Dict
+
Return the catalog root.
+def link_self(
+ self
+) -> Dict
+
Return the self link.
+def resolve(
+ self,
+ url
+)
+
Resolve url to the current request url.
+ + + + + + + + + + + + + +Unused search model.
+ + + + + + + + + + + + + +Serializers.
+class CollectionSerializer(
+
+)
+
Serialization methods for STAC collections.
+def db_to_stac(
+ collection: dict,
+ base_url: str
+) -> stac_fastapi.types.stac.Collection
+
Transform database model to STAC collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +dict | +The collection data in dictionary form, extracted from the database. | +None | +
base_url | +str | +The base URL for the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Collection | +The STAC collection object. | +
def stac_to_db(
+ collection: stac_fastapi.types.stac.Collection,
+ base_url: str
+) -> stac_fastapi.types.stac.Collection
+
Transform STAC Collection to database-ready STAC collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
stac_data | +None | +the STAC Collection object to be transformed | +None | +
base_url | +None | +the base URL for the STAC API | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Collection | +The database-ready STAC Collection object. | +
class ItemSerializer(
+
+)
+
Serialization methods for STAC items.
+def db_to_stac(
+ item: dict,
+ base_url: str
+) -> stac_fastapi.types.stac.Item
+
Transform database-ready STAC item to STAC item.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +dict | +The database-ready STAC item to be transformed. | +None | +
base_url | +str | +The base URL for the STAC API. | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Item | +The STAC item object. | +
def stac_to_db(
+ stac_data: stac_fastapi.types.stac.Item,
+ base_url: str
+) -> stac_fastapi.types.stac.Item
+
Transform STAC item to database-ready STAC item.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
stac_data | +stac_types.Item | +The STAC item object to be transformed. | +None | +
base_url | +str | +The base URL for the STAC API. | +None | +
Returns:
+Type | +Description | +
---|---|
stac_types.Item | +The database-ready STAC item object. | +
class Serializer(
+
+)
+
Defines serialization methods between the API and the data model.
+This class is meant to be subclassed and implemented by specific serializers for different STAC objects (e.g. Item, Collection).
+def db_to_stac(
+ item: dict,
+ base_url: str
+) -> Any
+
Transform database model to STAC object.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +dict | +A dictionary representing the database model. | +None | +
base_url | +str | +The base URL of the STAC API. | +None | +
Returns:
+Type | +Description | +
---|---|
Any | +A STAC object, e.g. an Item or Collection , representing the input item . |
+
def stac_to_db(
+ stac_object: Any,
+ base_url: str
+) -> dict
+
Transform STAC object to database model.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
stac_object | +Any | +A STAC object, e.g. an Item or Collection . |
+None | +
base_url | +str | +The base URL of the STAC API. | +None | +
Returns:
+Type | +Description | +
---|---|
dict | +A dictionary representing the database model. | +
database session management.
+logger
+
class Session(
+
+)
+
Database session management.
+def create_from_env(
+
+)
+
Create from environment.
+def create_from_settings(
+ settings
+)
+
Create a Session object from settings.
+ + + + + + + + + + + + + +Module for geospatial processing functions.
+This module contains functions for transforming geospatial coordinates, +such as converting bounding boxes to polygon representations.
+def bbox2polygon(
+ b0: float,
+ b1: float,
+ b2: float,
+ b3: float
+) -> List[List[List[float]]]
+
Transform a bounding box represented by its four coordinates b0
, b1
, b2
, and b3
into a polygon.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
b0 | +float | +The x-coordinate of the lower-left corner of the bounding box. | +None | +
b1 | +float | +The y-coordinate of the lower-left corner of the bounding box. | +None | +
b2 | +float | +The x-coordinate of the upper-right corner of the bounding box. | +None | +
b3 | +float | +The y-coordinate of the upper-right corner of the bounding box. | +None | +
Returns:
+Type | +Description | +
---|---|
List[List[List[float]]] | +A polygon represented as a list of lists of coordinates. | +
library version.
+ + + + + + + + + + + + + +FastAPI application.
+api
+
app
+
database_logic
+
extensions
+
filter_extension
+
handler
+
session
+
settings
+
def create_handler(
+ app
+)
+
Create a handler to use with AWS Lambda if mangum available.
+def run(
+
+) -> None
+
Run app from command line using uvicorn if available.
+class post_request_model(
+ __pydantic_self__,
+ **data: Any
+)
+
Search model.
+Replace base model in STAC-pydantic as it includes additional fields, not in the core +model. +github.com/radiantearth/stac-api-spec/tree/master/item-search#query-parameter-table
+PR to fix this: +stac-utils/stac-pydantic!100
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def validate_bbox(
+ v: Union[str, Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
+) -> Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
+
Check order of supplied bbox coordinates.
+def validate_datetime(
+ v: Union[str, datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
+) -> Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
+
Parse datetime.
+def validate_spatial(
+ v,
+ values
+)
+
Check bbox and intersects are not both supplied.
+end_date
+
Extract the end date from the datetime string.
+spatial_filter
+
Return a geojson-pydantic object representing the spatial filter for the search
+request.
+Check for both because the bbox
and intersects
parameters are
+mutually exclusive.
start_date
+
Extract the start date from the datetime string.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
API configuration.
+class AsyncElasticsearchSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7efc28aa7c30>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
API settings.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
create_client
+
Create async elasticsearch client.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class ElasticsearchSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7efc28aa7c30>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
API settings.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
create_client
+
Create es client.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Database logic.
+COLLECTIONS_INDEX
+
DEFAULT_SORT
+
ES_COLLECTIONS_MAPPINGS
+
ES_INDEX_NAME_UNSUPPORTED_CHARS
+
ES_ITEMS_MAPPINGS
+
ES_ITEMS_SETTINGS
+
ES_MAPPINGS_DYNAMIC_TEMPLATES
+
ITEMS_INDEX_PREFIX
+
ITEM_INDICES
+
NumType
+
logger
+
def create_collection_index(
+
+) -> None
+
Create the index for a Collection. The settings of the index template will be used implicitly.
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def create_index_templates(
+
+) -> None
+
Create index templates for the Collection and Item indices.
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def create_item_index(
+ collection_id: str
+)
+
Create the index for Items. The settings of the index template will be used implicitly.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +Collection identifier. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
def delete_item_index(
+ collection_id: str
+)
+
Delete the index for items in a collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The ID of the collection whose items index will be deleted. | +None | +
def index_by_collection_id(
+ collection_id: str
+) -> str
+
Translate a collection id into an Elasticsearch index name.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The collection id to translate into an index name. | +None | +
Returns:
+Type | +Description | +
---|---|
str | +The index name derived from the collection id. | +
def indices(
+ collection_ids: Union[List[str], NoneType]
+) -> str
+
Get a comma-separated string of index names for a given list of collection ids.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_ids | +None | +A list of collection ids. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +A string of comma-separated index names. If collection_ids is None, returns the default indices. |
+
def mk_actions(
+ collection_id: str,
+ processed_items: List[stac_fastapi.types.stac.Item]
+)
+
Create Elasticsearch bulk actions for a list of processed items.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The identifier for the collection the items belong to. | +None | +
processed_items | +List[Item] | +The list of processed items to be bulk indexed. | +None | +
Returns:
+Type | +Description | +
---|---|
List[Dict[str, Union[str, Dict]]] | +The list of bulk actions to be executed, each action being a dictionary with the following keys: - _index : the index to store the document in.- _id : the document's identifier.- _source : the source of the document. |
+
def mk_item_id(
+ item_id: str,
+ collection_id: str
+)
+
Create the document id for an Item in Elasticsearch.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +str | +The id of the Item. | +None | +
collection_id | +str | +The id of the Collection that the Item belongs to. | +None | +
Returns:
+Type | +Description | +
---|---|
str | +The document id for the Item, combining the Item id and the Collection id, separated by a | character. |
+
class DatabaseLogic(
+ item_serializer: Type[stac_fastapi.core.serializers.ItemSerializer] = <class 'stac_fastapi.core.serializers.ItemSerializer'>,
+ collection_serializer: Type[stac_fastapi.core.serializers.CollectionSerializer] = <class 'stac_fastapi.core.serializers.CollectionSerializer'>
+)
+
Database logic.
+client
+
sync_client
+
def apply_bbox_filter(
+ search: elasticsearch_dsl.search.Search,
+ bbox: List
+)
+
Filter search results based on bounding box.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to apply the filter to. | +None | +
bbox | +List | +The bounding box coordinates, represented as a list of four values [minx, miny, maxx, maxy]. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +search (Search): The search object with the bounding box filter applied. | +
def apply_collections_filter(
+ search: elasticsearch_dsl.search.Search,
+ collection_ids: List[str]
+)
+
Database logic to search a list of STAC collection ids.
+def apply_cql2_filter(
+ search: elasticsearch_dsl.search.Search,
+ _filter: Union[Dict[str, Any], NoneType]
+)
+
Database logic to perform query for search endpoint.
+def apply_datetime_filter(
+ search: elasticsearch_dsl.search.Search,
+ datetime_search
+)
+
Apply a filter to search based on datetime field.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to filter. | +None | +
datetime_search | +dict | +The datetime filter criteria. | +None | +
Returns:
+Type | +Description | +
---|---|
Search | +The filtered search object. | +
def apply_ids_filter(
+ search: elasticsearch_dsl.search.Search,
+ item_ids: List[str]
+)
+
Database logic to search a list of STAC item ids.
+def apply_intersects_filter(
+ search: elasticsearch_dsl.search.Search,
+ intersects: stac_fastapi.elasticsearch.database_logic.Geometry
+)
+
Filter search results based on intersecting geometry.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to apply the filter to. | +None | +
intersects | +Geometry | +The intersecting geometry, represented as a GeoJSON-like object. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +search (Search): The search object with the intersecting geometry filter applied. | +
def apply_stacql_filter(
+ search: elasticsearch_dsl.search.Search,
+ op: str,
+ field: str,
+ value: float
+)
+
Filter search results based on a comparison between a field and a value.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to apply the filter to. | +None | +
op | +str | +The comparison operator to use. Can be 'eq' (equal), 'gt' (greater than), 'gte' (greater than or equal), 'lt' (less than), or 'lte' (less than or equal). |
+None | +
field | +str | +The field to perform the comparison on. | +None | +
value | +float | +The value to compare the field against. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +search (Search): The search object with the specified filter applied. | +
def make_search(
+
+)
+
Database logic to create a Search instance.
+def populate_sort(
+ sortby: List
+) -> Union[Dict[str, Dict[str, str]], NoneType]
+
Database logic to sort search instance.
+def bulk_async(
+ self,
+ collection_id: str,
+ processed_items: List[stac_fastapi.types.stac.Item],
+ refresh: bool = False
+) -> None
+
Perform a bulk insert of items into the database asynchronously.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to which the items belong. | +None | +
processed_items | +List[Item] | +A list of Item objects to be inserted into the database. |
+None | +
refresh | +bool | +Whether to refresh the index after the bulk insert (default: False). | +None | +
def bulk_sync(
+ self,
+ collection_id: str,
+ processed_items: List[stac_fastapi.types.stac.Item],
+ refresh: bool = False
+) -> None
+
Perform a bulk insert of items into the database synchronously.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to which the items belong. | +None | +
processed_items | +List[Item] | +A list of Item objects to be inserted into the database. |
+None | +
refresh | +bool | +Whether to refresh the index after the bulk insert (default: False). | +None | +
def check_collection_exists(
+ self,
+ collection_id: str
+)
+
Database logic to check if a collection exists.
+def create_collection(
+ self,
+ collection: stac_fastapi.types.stac.Collection,
+ refresh: bool = False
+)
+
Create a single collection in the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +Collection | +The Collection object to be created. | +None | +
refresh | +bool | +Whether to refresh the index after the creation. Default is False. | +None | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If a Collection with the same id already exists in the database. | +
def create_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ refresh: bool = False
+)
+
Database logic for creating one item.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +Item | +The item to be created. | +None | +
refresh | +bool | +Refresh the index after performing the operation. Defaults to False. | +False | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If the item already exists in the database. | +
def delete_collection(
+ self,
+ collection_id: str,
+ refresh: bool = False
+)
+
Delete a collection from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to be deleted. | +None | +
refresh | +bool | +Whether to refresh the index after the deletion (default: False). | +None | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection with the given collection_id is not found in the database. |
+
def delete_collections(
+ self
+) -> None
+
Danger. this is only for tests.
+def delete_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ refresh: bool = False
+)
+
Delete a single item from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +str | +The id of the Item to be deleted. | +None | +
collection_id | +str | +The id of the Collection that the Item belongs to. | +None | +
refresh | +bool | +Whether to refresh the index after the deletion. Default is False. | +None | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the Item does not exist in the database. | +
def delete_items(
+ self
+) -> None
+
Danger. this is only for tests.
+def execute_search(
+ self,
+ search: elasticsearch_dsl.search.Search,
+ limit: int,
+ token: Union[str, NoneType],
+ sort: Union[Dict[str, Dict[str, str]], NoneType],
+ collection_ids: Union[List[str], NoneType],
+ ignore_unavailable: bool = True
+) -> Tuple[Iterable[Dict[str, Any]], Union[int, NoneType], Union[str, NoneType]]
+
Execute a search query with limit and other optional parameters.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search query to be executed. | +None | +
limit | +int | +The maximum number of results to be returned. | +None | +
token | +Optional[str] | +The token used to return the next set of results. | +None | +
sort | +Optional[Dict[str, Dict[str, str]]] | +Specifies how the results should be sorted. | +None | +
collection_ids | +Optional[List[str]] | +The collection ids to search. | +None | +
ignore_unavailable | +bool | +Whether to ignore unavailable collections. Defaults to True. | +True | +
Returns:
+Type | +Description | +
---|---|
Tuple[Iterable[Dict[str, Any]], Optional[int], Optional[str]] | +A tuple containing: - An iterable of search results, where each result is a dictionary with keys and values representing the fields and values of each document. - The total number of results (if the count could be computed), or None if the count could not be computed. - The token to be used to retrieve the next set of results, or None if there are no more results. |
+
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collections specified in collection_ids do not exist. |
+
def find_collection(
+ self,
+ collection_id: str
+) -> stac_fastapi.types.stac.Collection
+
Find and return a collection from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to be found. | +None | +
Returns:
+Type | +Description | +
---|---|
Collection | +The found collection, represented as a Collection object. |
+
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection with the given collection_id is not found in the database. |
+
def get_all_collections(
+ self,
+ token: Union[str, NoneType],
+ limit: int,
+ base_url: str
+) -> Tuple[List[Dict[str, Any]], Union[str, NoneType]]
+
Retrieve a list of all collections from Elasticsearch, supporting pagination.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
token | +Optional[str] | +The pagination token. | +None | +
limit | +int | +The number of results to return. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +A tuple of (collections, next pagination token if any). | +
def get_one_item(
+ self,
+ collection_id: str,
+ item_id: str
+) -> Dict
+
Retrieve a single item from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The id of the Collection that the Item belongs to. | +None | +
item_id | +str | +The id of the Item. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +item (Dict): A dictionary containing the source data for the Item. | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the specified Item does not exist in the Collection. | +
def prep_create_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ base_url: str,
+ exist_ok: bool = False
+) -> stac_fastapi.types.stac.Item
+
Preps an item for insertion into the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +Item | +The item to be prepped for insertion. | +None | +
base_url | +str | +The base URL used to create the item's self URL. | +None | +
exist_ok | +bool | +Indicates whether the item can exist already. | +None | +
Returns:
+Type | +Description | +
---|---|
Item | +The prepped item. | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If the item already exists in the database. | +
def sync_prep_create_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ base_url: str,
+ exist_ok: bool = False
+) -> stac_fastapi.types.stac.Item
+
Prepare an item for insertion into the database.
+This method performs pre-insertion preparation on the given item
,
+such as checking if the collection the item belongs to exists,
+and optionally verifying that an item with the same ID does not already exist in the database.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +Item | +The item to be inserted into the database. | +None | +
base_url | +str | +The base URL used for constructing URLs for the item. | +None | +
exist_ok | +bool | +Indicates whether the item can exist already. | +None | +
Returns:
+Type | +Description | +
---|---|
Item | +The item after preparation is done. | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection that the item belongs to does not exist in the database. | +
ConflictError | +If an item with the same ID already exists in the collection. | +
def update_collection(
+ self,
+ collection_id: str,
+ collection: stac_fastapi.types.stac.Collection,
+ refresh: bool = False
+)
+
Update a collection from the database.
+Args: + self: The instance of the object calling this function. + collection_id (str): The ID of the collection to be updated. + collection (Collection): The Collection object to be used for the update.
+Raises:
+ NotFoundError: If the collection with the given collection_id
is not
+ found in the database.
Notes:
+ This function updates the collection in the database using the specified
+ collection_id
and with the collection specified in the Collection
object.
+ If the collection is not found, a NotFoundError
is raised.
class Geometry(
+ *args,
+ **kwargs
+)
+
Base class for protocol classes.
+Protocol classes are defined as::
+class Proto(Protocol):
+ def meth(self) -> int:
+ ...
+
Such classes are primarily used with static type checkers that recognize +structural subtyping (static duck-typing), for example::
+class C:
+ def meth(self) -> int:
+ return 0
+
+def func(x: Proto) -> int:
+ return x.meth()
+
+func(C()) # Passes static type check
+
See PEP 544 for details. Protocol classes decorated with
+library version.
+ + + + + + + + + + + + + +Context extension.
+class ContextExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = 'https://raw.githubusercontent.com/stac-api-extensions/context/v1.0.0-rc.2/json-schema/schema.json'
+)
+
Context Extension.
+The Context extension adds a JSON object to ItemCollection responses (/search
,
+/collections/{collection_id}/items
) which includes the number of items matched,
+returned, and the limit requested.
+stac-api-extensions/context
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Fields extension.
+class FieldsExtension(
+ conformance_classes: List[str] = NOTHING,
+ default_includes: Set[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Fields Extension.
+The Fields extension adds functionality to the /search
endpoint which
+allows the caller to include or exclude specific from the API response.
+Registering this extension with the application has the added effect of
+removing the ItemCollection
response model from the /search
endpoint, as
+the Fields extension allows the API to return potentially invalid responses
+by excluding fields which are required by the STAC spec, such as geometry.
Name | +Type | +Description | +Default | +
---|---|---|---|
default_includes | +set | +defines the default set of included fields. | +None | +
conformance_classes | +list | +Defines the list of conformance classes for the extension |
+None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +fastapi.FastAPI | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Fields extension module.
+class FieldsExtension(
+ conformance_classes: List[str] = NOTHING,
+ default_includes: Set[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Fields Extension.
+The Fields extension adds functionality to the /search
endpoint which
+allows the caller to include or exclude specific from the API response.
+Registering this extension with the application has the added effect of
+removing the ItemCollection
response model from the /search
endpoint, as
+the Fields extension allows the API to return potentially invalid responses
+by excluding fields which are required by the STAC spec, such as geometry.
Name | +Type | +Description | +Default | +
---|---|---|---|
default_includes | +set | +defines the default set of included fields. | +None | +
conformance_classes | +list | +Defines the list of conformance classes for the extension |
+None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +fastapi.FastAPI | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Request models for the fields extension.
+class FieldsExtensionGetRequest(
+ fields: str = None
+)
+
Additional fields for the GET request.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class FieldsExtensionPostRequest(
+ __pydantic_self__,
+ **data: Any
+)
+
Additional fields and schema for the POST request.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class PostFieldsExtension(
+ __pydantic_self__,
+ **data: Any
+)
+
FieldsExtension.
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +set of fields to include. | +None | +
exclude | +None | +set of fields to exclude. | +None | +
Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
filter_fields
+
Create pydantic include/exclude expression.
+Create dictionary of fields to include/exclude on model export based on +the included and excluded fields passed to the API +Ref: pydantic-docs.helpmanual.io/usage/exporting_models/#advanced-include-and-exclude
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Filter Extension.
+class FilterConformanceClasses(
+ /,
+ *args,
+ **kwargs
+)
+
Conformance classes for the Filter extension.
+See +stac-api-extensions/filter
+ACCENT_CASE_INSENSITIVE_COMPARISON
+
ADVANCED_COMPARISON_OPERATORS
+
ARITHMETIC
+
ARRAYS
+
BASIC_CQL2
+
BASIC_SPATIAL_OPERATORS
+
CQL2_JSON
+
CQL2_TEXT
+
FEATURES_FILTER
+
FILTER
+
FUNCTIONS
+
ITEM_SEARCH_FILTER
+
PROPERTY_PROPERTY
+
SPATIAL_OPERATORS
+
TEMPORAL_OPERATORS
+
name
+
value
+
class FilterExtension(
+ schema_href: Union[str, NoneType] = None,
+ client: Union[stac_fastapi.types.core.AsyncBaseFiltersClient, stac_fastapi.types.core.BaseFiltersClient] = NOTHING,
+ conformance_classes: List[str] = [<FilterConformanceClasses.FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter'>, <FilterConformanceClasses.FEATURES_FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter'>, <FilterConformanceClasses.ITEM_SEARCH_FILTER: 'https://api.stacspec.org/v1.0.0-rc.2/item-search#filter'>, <FilterConformanceClasses.BASIC_CQL2: 'http://www.opengis.net/spec/cql2/1.0/conf/basic-cql2'>, <FilterConformanceClasses.CQL2_JSON: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-json'>, <FilterConformanceClasses.CQL2_TEXT: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-text'>, 'http://www.opengis.net/spec/cql2/1.0/conf/advanced-comparison-operators', 'http://www.opengis.net/spec/cql2/1.0/conf/advanced-comparison-operators'],
+ router: fastapi.routing.APIRouter = NOTHING,
+ response_class: Type[starlette.responses.Response] = <class 'stac_fastapi.api.models.JSONSchemaResponse'>
+)
+
Filter Extension.
+The filter extension adds several endpoints which allow the retrieval of +queryables and provides an expressive mechanism for searching based on Item
+Name | +Type | +Description | +Default | +
---|---|---|---|
client | +None | +Queryables endpoint logic | +None | +
conformance_classes | +None | +Conformance classes provided by the extension | +None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Filter extension module.
+class FilterExtension(
+ schema_href: Union[str, NoneType] = None,
+ client: Union[stac_fastapi.types.core.AsyncBaseFiltersClient, stac_fastapi.types.core.BaseFiltersClient] = NOTHING,
+ conformance_classes: List[str] = [<FilterConformanceClasses.FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter'>, <FilterConformanceClasses.FEATURES_FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter'>, <FilterConformanceClasses.ITEM_SEARCH_FILTER: 'https://api.stacspec.org/v1.0.0-rc.2/item-search#filter'>, <FilterConformanceClasses.BASIC_CQL2: 'http://www.opengis.net/spec/cql2/1.0/conf/basic-cql2'>, <FilterConformanceClasses.CQL2_JSON: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-json'>, <FilterConformanceClasses.CQL2_TEXT: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-text'>, 'http://www.opengis.net/spec/cql2/1.0/conf/advanced-comparison-operators', 'http://www.opengis.net/spec/cql2/1.0/conf/advanced-comparison-operators'],
+ router: fastapi.routing.APIRouter = NOTHING,
+ response_class: Type[starlette.responses.Response] = <class 'stac_fastapi.api.models.JSONSchemaResponse'>
+)
+
Filter Extension.
+The filter extension adds several endpoints which allow the retrieval of +queryables and provides an expressive mechanism for searching based on Item
+Name | +Type | +Description | +Default | +
---|---|---|---|
client | +None | +Queryables endpoint logic | +None | +
conformance_classes | +None | +Conformance classes provided by the extension | +None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Filter extension request models.
+class FilterExtensionGetRequest(
+ filter: Union[str, NoneType] = None
+)
+
Filter extension GET request model.
+filter_crs
+
filter_lang
+
def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class FilterExtensionPostRequest(
+ __pydantic_self__,
+ **data: Any
+)
+
Filter extension POST request model.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class FilterLang(
+ /,
+ *args,
+ **kwargs
+)
+
Choices for filter-lang value in a POST request.
+Based on +stac-api-extensions/filter#queryables
+Note the addition of cql2-json, which is used by the pgstac backend, +but is not included in the spec above.
+cql2_json
+
cql2_text
+
cql_json
+
name
+
value
+
stac_api.extensions.core module.
+class ContextExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = 'https://raw.githubusercontent.com/stac-api-extensions/context/v1.0.0-rc.2/json-schema/schema.json'
+)
+
Context Extension.
+The Context extension adds a JSON object to ItemCollection responses (/search
,
+/collections/{collection_id}/items
) which includes the number of items matched,
+returned, and the limit requested.
+stac-api-extensions/context
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class FieldsExtension(
+ conformance_classes: List[str] = NOTHING,
+ default_includes: Set[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Fields Extension.
+The Fields extension adds functionality to the /search
endpoint which
+allows the caller to include or exclude specific from the API response.
+Registering this extension with the application has the added effect of
+removing the ItemCollection
response model from the /search
endpoint, as
+the Fields extension allows the API to return potentially invalid responses
+by excluding fields which are required by the STAC spec, such as geometry.
Name | +Type | +Description | +Default | +
---|---|---|---|
default_includes | +set | +defines the default set of included fields. | +None | +
conformance_classes | +list | +Defines the list of conformance classes for the extension |
+None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +fastapi.FastAPI | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class FilterExtension(
+ schema_href: Union[str, NoneType] = None,
+ client: Union[stac_fastapi.types.core.AsyncBaseFiltersClient, stac_fastapi.types.core.BaseFiltersClient] = NOTHING,
+ conformance_classes: List[str] = [<FilterConformanceClasses.FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter'>, <FilterConformanceClasses.FEATURES_FILTER: 'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter'>, <FilterConformanceClasses.ITEM_SEARCH_FILTER: 'https://api.stacspec.org/v1.0.0-rc.2/item-search#filter'>, <FilterConformanceClasses.BASIC_CQL2: 'http://www.opengis.net/spec/cql2/1.0/conf/basic-cql2'>, <FilterConformanceClasses.CQL2_JSON: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-json'>, <FilterConformanceClasses.CQL2_TEXT: 'http://www.opengis.net/spec/cql2/1.0/conf/cql2-text'>, 'http://www.opengis.net/spec/cql2/1.0/conf/advanced-comparison-operators', 'http://www.opengis.net/spec/cql2/1.0/conf/advanced-comparison-operators'],
+ router: fastapi.routing.APIRouter = NOTHING,
+ response_class: Type[starlette.responses.Response] = <class 'stac_fastapi.api.models.JSONSchemaResponse'>
+)
+
Filter Extension.
+The filter extension adds several endpoints which allow the retrieval of +queryables and provides an expressive mechanism for searching based on Item
+Name | +Type | +Description | +Default | +
---|---|---|---|
client | +None | +Queryables endpoint logic | +None | +
conformance_classes | +None | +Conformance classes provided by the extension | +None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class PaginationExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Token Pagination.
+Though not strictly an extension, the chosen pagination will modify the form of the +request object. By making pagination an extension class, we can use +create_request_model to dynamically add the correct pagination parameter to the +request model for OpenAPI generation.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class QueryExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Query Extension.
+The Query extension adds an additional query
parameter to /search
requests which
+allows the caller to perform queries against item metadata (ex. find all images with
+cloud cover less than 15%).
+github.com/radiantearth/stac-api-spec/blob/master/item-search/README.md#query
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class SortExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Sort Extension.
+The Sort extension adds the sortby
parameter to the /search
endpoint, allowing the
+caller to specify the sort order of the returned items.
+stac-api-extensions/sort
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class TokenPaginationExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Token Pagination.
+Though not strictly an extension, the chosen pagination will modify the form of the +request object. By making pagination an extension class, we can use +create_request_model to dynamically add the correct pagination parameter to the +request model for OpenAPI generation.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class TransactionExtension(
+ client: Union[stac_fastapi.types.core.AsyncBaseTransactionsClient, stac_fastapi.types.core.BaseTransactionsClient],
+ settings: stac_fastapi.types.config.ApiSettings,
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None,
+ router: fastapi.routing.APIRouter = NOTHING,
+ response_class: Type[starlette.responses.Response] = <class 'starlette.responses.JSONResponse'>
+)
+
Transaction Extension.
+The transaction extension adds several endpoints which allow the creation, +deletion, and updating of items and collections: + POST /collections + PUT /collections/{collection_id} + DELETE /collections/{collection_id} + POST /collections/{collection_id}/items + PUT /collections/{collection_id}/items + DELETE /collections/{collection_id}/items
+github.com/radiantearth/stac-api-spec/blob/master/ogcapi-features/extensions/transaction/README.md
+Name | +Type | +Description | +Default | +
---|---|---|---|
client | +None | +CRUD application logic | +None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_create_collection(
+ self
+)
+
Register create collection endpoint (POST /collections).
+def register_create_item(
+ self
+)
+
Register create item endpoint (POST /collections/{collection_id}/items).
+def register_delete_collection(
+ self
+)
+
Register delete collection endpoint (DELETE /collections/{collection_id}).
+def register_delete_item(
+ self
+)
+
Register delete item endpoint (DELETE
+/collections/{collection_id}/items/{item_id}).
+def register_update_collection(
+ self
+)
+
Register update collection endpoint (PUT /collections/{collection_id}).
+def register_update_item(
+ self
+)
+
Register update item endpoint (PUT
+/collections/{collection_id}/items/{item_id}).
+ + + + + + + + + + + + + +Pagination classes as extensions.
+class PaginationExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Token Pagination.
+Though not strictly an extension, the chosen pagination will modify the form of the +request object. By making pagination an extension class, we can use +create_request_model to dynamically add the correct pagination parameter to the +request model for OpenAPI generation.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class TokenPaginationExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Token Pagination.
+Though not strictly an extension, the chosen pagination will modify the form of the +request object. By making pagination an extension class, we can use +create_request_model to dynamically add the correct pagination parameter to the +request model for OpenAPI generation.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Pagination API extension.
+class PaginationExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Token Pagination.
+Though not strictly an extension, the chosen pagination will modify the form of the +request object. By making pagination an extension class, we can use +create_request_model to dynamically add the correct pagination parameter to the +request model for OpenAPI generation.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Token pagination API extension.
+class TokenPaginationExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Token Pagination.
+Though not strictly an extension, the chosen pagination will modify the form of the +request object. By making pagination an extension class, we can use +create_request_model to dynamically add the correct pagination parameter to the +request model for OpenAPI generation.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Query extension module.
+class QueryExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Query Extension.
+The Query extension adds an additional query
parameter to /search
requests which
+allows the caller to perform queries against item metadata (ex. find all images with
+cloud cover less than 15%).
+github.com/radiantearth/stac-api-spec/blob/master/item-search/README.md#query
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Query extension.
+class QueryExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Query Extension.
+The Query extension adds an additional query
parameter to /search
requests which
+allows the caller to perform queries against item metadata (ex. find all images with
+cloud cover less than 15%).
+github.com/radiantearth/stac-api-spec/blob/master/item-search/README.md#query
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Request model for the Query extension.
+class QueryExtensionGetRequest(
+ query: Union[str, NoneType] = None
+)
+
Query Extension GET request model.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class QueryExtensionPostRequest(
+ __pydantic_self__,
+ **data: Any
+)
+
Query Extension POST request model.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Sort extension module.
+class SortExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Sort Extension.
+The Sort extension adds the sortby
parameter to the /search
endpoint, allowing the
+caller to specify the sort order of the returned items.
+stac-api-extensions/sort
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Request model for the Sort Extension.
+class SortExtensionGetRequest(
+ sortby: str = None
+)
+
Sortby Parameter for GET requests.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class SortExtensionPostRequest(
+ __pydantic_self__,
+ **data: Any
+)
+
Sortby parameter for POST requests.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Sort extension.
+class SortExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Sort Extension.
+The Sort extension adds the sortby
parameter to the /search
endpoint, allowing the
+caller to specify the sort order of the returned items.
+stac-api-extensions/sort
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Transaction extension.
+class PostItem(
+ collection_id: str = Path(Ellipsis),
+ item: Union[stac_fastapi.types.stac.Item, stac_fastapi.types.stac.ItemCollection] = Body(None)
+)
+
Create Item.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class PutCollection(
+ collection_id: str = Path(Ellipsis),
+ collection: stac_fastapi.types.stac.Collection = Body(None)
+)
+
Update Collection.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class PutItem(
+ collection_id: str = Path(Ellipsis),
+ item_id: str = Path(Ellipsis),
+ item: stac_fastapi.types.stac.Item = Body(None)
+)
+
Update Item.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class TransactionExtension(
+ client: Union[stac_fastapi.types.core.AsyncBaseTransactionsClient, stac_fastapi.types.core.BaseTransactionsClient],
+ settings: stac_fastapi.types.config.ApiSettings,
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None,
+ router: fastapi.routing.APIRouter = NOTHING,
+ response_class: Type[starlette.responses.Response] = <class 'starlette.responses.JSONResponse'>
+)
+
Transaction Extension.
+The transaction extension adds several endpoints which allow the creation, +deletion, and updating of items and collections: + POST /collections + PUT /collections/{collection_id} + DELETE /collections/{collection_id} + POST /collections/{collection_id}/items + PUT /collections/{collection_id}/items + DELETE /collections/{collection_id}/items
+github.com/radiantearth/stac-api-spec/blob/master/ogcapi-features/extensions/transaction/README.md
+Name | +Type | +Description | +Default | +
---|---|---|---|
client | +None | +CRUD application logic | +None | +
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
def register_create_collection(
+ self
+)
+
Register create collection endpoint (POST /collections).
+def register_create_item(
+ self
+)
+
Register create item endpoint (POST /collections/{collection_id}/items).
+def register_delete_collection(
+ self
+)
+
Register delete collection endpoint (DELETE /collections/{collection_id}).
+def register_delete_item(
+ self
+)
+
Register delete item endpoint (DELETE
+/collections/{collection_id}/items/{item_id}).
+def register_update_collection(
+ self
+)
+
Register update collection endpoint (PUT /collections/{collection_id}).
+def register_update_item(
+ self
+)
+
Register update item endpoint (PUT
+/collections/{collection_id}/items/{item_id}).
+ + + + + + + + + + + + + +Bulk transactions extension.
+class AsyncBaseBulkTransactionsClient(
+
+)
+
BulkTransactionsClient.
+def bulk_item_insert(
+ self,
+ items: stac_fastapi.extensions.third_party.bulk_transactions.Items,
+ **kwargs
+) -> str
+
Bulk creation of items.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
items | +None | +list of items. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +Message indicating the status of the insert. | +
class BaseBulkTransactionsClient(
+
+)
+
BulkTransactionsClient.
+def bulk_item_insert(
+ self,
+ items: stac_fastapi.extensions.third_party.bulk_transactions.Items,
+ chunk_size: Union[int, NoneType] = None,
+ **kwargs
+) -> str
+
Bulk creation of items.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
items | +None | +list of items. | +None | +
chunk_size | +None | +number of items processed at a time. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +Message indicating the status of the insert. | +
class BulkTransactionExtension(
+ client: Union[stac_fastapi.extensions.third_party.bulk_transactions.AsyncBaseBulkTransactionsClient, stac_fastapi.extensions.third_party.bulk_transactions.BaseBulkTransactionsClient],
+ conformance_classes: List[str] = [],
+ schema_href: Union[str, NoneType] = None
+)
+
Bulk Transaction Extension.
+Bulk Transaction extension adds the POST
+/collections/{collection_id}/bulk_items
endpoint to the application for
+efficient bulk insertion of items. The input to this is an object with an
+attribute "items", that has a value that is an object with a group of
+attributes that are the ids of each Item, and the value is the Item entity.
Optionally, clients can specify a "method" attribute that is either "insert" +or "upsert". If "insert", then the items will be inserted if they do not +exist, and an error will be returned if they do. If "upsert", then the items +will be inserted if they do not exist, and updated if they do. This defaults +to "insert".
+{
+ "items": {
+ "id1": { "type": "Feature", ... },
+ "id2": { "type": "Feature", ... },
+ "id3": { "type": "Feature", ... }
+ },
+ "method": "insert"
+}
+
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
class BulkTransactionMethod(
+ /,
+ *args,
+ **kwargs
+)
+
Bulk Transaction Methods.
+INSERT
+
UPSERT
+
name
+
value
+
class Items(
+ __pydantic_self__,
+ **data: Any
+)
+
A group of STAC Item objects, in the form of a dictionary from Item.id -> Item.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
stac_api.extensions.third_party module.
+class BulkTransactionExtension(
+ client: Union[stac_fastapi.extensions.third_party.bulk_transactions.AsyncBaseBulkTransactionsClient, stac_fastapi.extensions.third_party.bulk_transactions.BaseBulkTransactionsClient],
+ conformance_classes: List[str] = [],
+ schema_href: Union[str, NoneType] = None
+)
+
Bulk Transaction Extension.
+Bulk Transaction extension adds the POST
+/collections/{collection_id}/bulk_items
endpoint to the application for
+efficient bulk insertion of items. The input to this is an object with an
+attribute "items", that has a value that is an object with a group of
+attributes that are the ids of each Item, and the value is the Item entity.
Optionally, clients can specify a "method" attribute that is either "insert" +or "upsert". If "insert", then the items will be inserted if they do not +exist, and an error will be returned if they do. If "upsert", then the items +will be inserted if they do not exist, and updated if they do. This defaults +to "insert".
+{
+ "items": {
+ "id1": { "type": "Feature", ... },
+ "id2": { "type": "Feature", ... },
+ "id3": { "type": "Feature", ... }
+ },
+ "method": "insert"
+}
+
GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Library version.
+ + + + + + + + + + + + + +FastAPI application.
+api
+
app
+
database_logic
+
extensions
+
filter_extension
+
handler
+
session
+
settings
+
def create_handler(
+ app
+)
+
Create a handler to use with AWS Lambda if mangum available.
+def run(
+
+) -> None
+
Run app from command line using uvicorn if available.
+class post_request_model(
+ __pydantic_self__,
+ **data: Any
+)
+
Search model.
+Replace base model in STAC-pydantic as it includes additional fields, not in the core +model. +github.com/radiantearth/stac-api-spec/tree/master/item-search#query-parameter-table
+PR to fix this: +stac-utils/stac-pydantic!100
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def validate_bbox(
+ v: Union[str, Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
+) -> Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
+
Check order of supplied bbox coordinates.
+def validate_datetime(
+ v: Union[str, datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
+) -> Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
+
Parse datetime.
+def validate_spatial(
+ v,
+ values
+)
+
Check bbox and intersects are not both supplied.
+end_date
+
Extract the end date from the datetime string.
+spatial_filter
+
Return a geojson-pydantic object representing the spatial filter for the search
+request.
+Check for both because the bbox
and intersects
parameters are
+mutually exclusive.
start_date
+
Extract the start date from the datetime string.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
API configuration.
+class AsyncOpensearchSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7efc28aa7c30>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
API settings.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
create_client
+
Create async elasticsearch client.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class OpensearchSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7efc28aa7c30>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
API settings.
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
create_client
+
Create es client.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Database logic.
+COLLECTIONS_INDEX
+
DEFAULT_SORT
+
ES_COLLECTIONS_MAPPINGS
+
ES_INDEX_NAME_UNSUPPORTED_CHARS
+
ES_ITEMS_MAPPINGS
+
ES_ITEMS_SETTINGS
+
ES_MAPPINGS_DYNAMIC_TEMPLATES
+
ITEMS_INDEX_PREFIX
+
ITEM_INDICES
+
NumType
+
logger
+
def create_collection_index(
+
+) -> None
+
Create the index for a Collection. The settings of the index template will be used implicitly.
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def create_index_templates(
+
+) -> None
+
Create index templates for the Collection and Item indices.
+Returns:
+Type | +Description | +
---|---|
None | +None | +
def create_item_index(
+ collection_id: str
+)
+
Create the index for Items. The settings of the index template will be used implicitly.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +Collection identifier. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
def delete_item_index(
+ collection_id: str
+)
+
Delete the index for items in a collection.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The ID of the collection whose items index will be deleted. | +None | +
def index_by_collection_id(
+ collection_id: str
+) -> str
+
Translate a collection id into an Elasticsearch index name.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The collection id to translate into an index name. | +None | +
Returns:
+Type | +Description | +
---|---|
str | +The index name derived from the collection id. | +
def indices(
+ collection_ids: Union[List[str], NoneType]
+) -> str
+
Get a comma-separated string of index names for a given list of collection ids.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_ids | +None | +A list of collection ids. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +A string of comma-separated index names. If collection_ids is None, returns the default indices. |
+
def mk_actions(
+ collection_id: str,
+ processed_items: List[stac_fastapi.types.stac.Item]
+)
+
Create Elasticsearch bulk actions for a list of processed items.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The identifier for the collection the items belong to. | +None | +
processed_items | +List[Item] | +The list of processed items to be bulk indexed. | +None | +
Returns:
+Type | +Description | +
---|---|
List[Dict[str, Union[str, Dict]]] | +The list of bulk actions to be executed, each action being a dictionary with the following keys: - _index : the index to store the document in.- _id : the document's identifier.- _source : the source of the document. |
+
def mk_item_id(
+ item_id: str,
+ collection_id: str
+)
+
Create the document id for an Item in Elasticsearch.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +str | +The id of the Item. | +None | +
collection_id | +str | +The id of the Collection that the Item belongs to. | +None | +
Returns:
+Type | +Description | +
---|---|
str | +The document id for the Item, combining the Item id and the Collection id, separated by a | character. |
+
class DatabaseLogic(
+ item_serializer: Type[stac_fastapi.core.serializers.ItemSerializer] = <class 'stac_fastapi.core.serializers.ItemSerializer'>,
+ collection_serializer: Type[stac_fastapi.core.serializers.CollectionSerializer] = <class 'stac_fastapi.core.serializers.CollectionSerializer'>
+)
+
Database logic.
+client
+
sync_client
+
def apply_bbox_filter(
+ search: opensearchpy.helpers.search.Search,
+ bbox: List
+)
+
Filter search results based on bounding box.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to apply the filter to. | +None | +
bbox | +List | +The bounding box coordinates, represented as a list of four values [minx, miny, maxx, maxy]. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +search (Search): The search object with the bounding box filter applied. | +
def apply_collections_filter(
+ search: opensearchpy.helpers.search.Search,
+ collection_ids: List[str]
+)
+
Database logic to search a list of STAC collection ids.
+def apply_cql2_filter(
+ search: opensearchpy.helpers.search.Search,
+ _filter: Union[Dict[str, Any], NoneType]
+)
+
Database logic to perform query for search endpoint.
+def apply_datetime_filter(
+ search: opensearchpy.helpers.search.Search,
+ datetime_search
+)
+
Apply a filter to search based on datetime field.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to filter. | +None | +
datetime_search | +dict | +The datetime filter criteria. | +None | +
Returns:
+Type | +Description | +
---|---|
Search | +The filtered search object. | +
def apply_ids_filter(
+ search: opensearchpy.helpers.search.Search,
+ item_ids: List[str]
+)
+
Database logic to search a list of STAC item ids.
+def apply_intersects_filter(
+ search: opensearchpy.helpers.search.Search,
+ intersects: stac_fastapi.opensearch.database_logic.Geometry
+)
+
Filter search results based on intersecting geometry.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to apply the filter to. | +None | +
intersects | +Geometry | +The intersecting geometry, represented as a GeoJSON-like object. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +search (Search): The search object with the intersecting geometry filter applied. | +
def apply_stacql_filter(
+ search: opensearchpy.helpers.search.Search,
+ op: str,
+ field: str,
+ value: float
+)
+
Filter search results based on a comparison between a field and a value.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search object to apply the filter to. | +None | +
op | +str | +The comparison operator to use. Can be 'eq' (equal), 'gt' (greater than), 'gte' (greater than or equal), 'lt' (less than), or 'lte' (less than or equal). |
+None | +
field | +str | +The field to perform the comparison on. | +None | +
value | +float | +The value to compare the field against. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +search (Search): The search object with the specified filter applied. | +
def make_search(
+
+)
+
Database logic to create a Search instance.
+def populate_sort(
+ sortby: List
+) -> Union[Dict[str, Dict[str, str]], NoneType]
+
Database logic to sort search instance.
+def bulk_async(
+ self,
+ collection_id: str,
+ processed_items: List[stac_fastapi.types.stac.Item],
+ refresh: bool = False
+) -> None
+
Perform a bulk insert of items into the database asynchronously.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to which the items belong. | +None | +
processed_items | +List[Item] | +A list of Item objects to be inserted into the database. |
+None | +
refresh | +bool | +Whether to refresh the index after the bulk insert (default: False). | +None | +
def bulk_sync(
+ self,
+ collection_id: str,
+ processed_items: List[stac_fastapi.types.stac.Item],
+ refresh: bool = False
+) -> None
+
Perform a bulk insert of items into the database synchronously.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to which the items belong. | +None | +
processed_items | +List[Item] | +A list of Item objects to be inserted into the database. |
+None | +
refresh | +bool | +Whether to refresh the index after the bulk insert (default: False). | +None | +
def check_collection_exists(
+ self,
+ collection_id: str
+)
+
Database logic to check if a collection exists.
+def create_collection(
+ self,
+ collection: stac_fastapi.types.stac.Collection,
+ refresh: bool = False
+)
+
Create a single collection in the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +Collection | +The Collection object to be created. | +None | +
refresh | +bool | +Whether to refresh the index after the creation. Default is False. | +None | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If a Collection with the same id already exists in the database. | +
def create_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ refresh: bool = False
+)
+
Database logic for creating one item.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +Item | +The item to be created. | +None | +
refresh | +bool | +Refresh the index after performing the operation. Defaults to False. | +False | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If the item already exists in the database. | +
def delete_collection(
+ self,
+ collection_id: str,
+ refresh: bool = False
+)
+
Delete a collection from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to be deleted. | +None | +
refresh | +bool | +Whether to refresh the index after the deletion (default: False). | +None | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection with the given collection_id is not found in the database. |
+
def delete_collections(
+ self
+) -> None
+
Danger. this is only for tests.
+def delete_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ refresh: bool = False
+)
+
Delete a single item from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +str | +The id of the Item to be deleted. | +None | +
collection_id | +str | +The id of the Collection that the Item belongs to. | +None | +
refresh | +bool | +Whether to refresh the index after the deletion. Default is False. | +None | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the Item does not exist in the database. | +
def delete_items(
+ self
+) -> None
+
Danger. this is only for tests.
+def execute_search(
+ self,
+ search: opensearchpy.helpers.search.Search,
+ limit: int,
+ token: Union[str, NoneType],
+ sort: Union[Dict[str, Dict[str, str]], NoneType],
+ collection_ids: Union[List[str], NoneType],
+ ignore_unavailable: bool = True
+) -> Tuple[Iterable[Dict[str, Any]], Union[int, NoneType], Union[str, NoneType]]
+
Execute a search query with limit and other optional parameters.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search | +Search | +The search query to be executed. | +None | +
limit | +int | +The maximum number of results to be returned. | +None | +
token | +Optional[str] | +The token used to return the next set of results. | +None | +
sort | +Optional[Dict[str, Dict[str, str]]] | +Specifies how the results should be sorted. | +None | +
collection_ids | +Optional[List[str]] | +The collection ids to search. | +None | +
ignore_unavailable | +bool | +Whether to ignore unavailable collections. Defaults to True. | +True | +
Returns:
+Type | +Description | +
---|---|
Tuple[Iterable[Dict[str, Any]], Optional[int], Optional[str]] | +A tuple containing: - An iterable of search results, where each result is a dictionary with keys and values representing the fields and values of each document. - The total number of results (if the count could be computed), or None if the count could not be computed. - The token to be used to retrieve the next set of results, or None if there are no more results. |
+
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collections specified in collection_ids do not exist. |
+
def find_collection(
+ self,
+ collection_id: str
+) -> stac_fastapi.types.stac.Collection
+
Find and return a collection from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
self | +None | +The instance of the object calling this function. | +None | +
collection_id | +str | +The ID of the collection to be found. | +None | +
Returns:
+Type | +Description | +
---|---|
Collection | +The found collection, represented as a Collection object. |
+
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection with the given collection_id is not found in the database. |
+
def get_all_collections(
+ self,
+ token: Union[str, NoneType],
+ limit: int,
+ base_url: str
+) -> Tuple[List[Dict[str, Any]], Union[str, NoneType]]
+
Retrieve a list of all collections from Opensearch, supporting pagination.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
token | +Optional[str] | +The pagination token. | +None | +
limit | +int | +The number of results to return. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +A tuple of (collections, next pagination token if any). | +
def get_one_item(
+ self,
+ collection_id: str,
+ item_id: str
+) -> Dict
+
Retrieve a single item from the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +str | +The id of the Collection that the Item belongs to. | +None | +
item_id | +str | +The id of the Item. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +item (Dict): A dictionary containing the source data for the Item. | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the specified Item does not exist in the Collection. | +
def prep_create_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ base_url: str,
+ exist_ok: bool = False
+) -> stac_fastapi.types.stac.Item
+
Preps an item for insertion into the database.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +Item | +The item to be prepped for insertion. | +None | +
base_url | +str | +The base URL used to create the item's self URL. | +None | +
exist_ok | +bool | +Indicates whether the item can exist already. | +None | +
Returns:
+Type | +Description | +
---|---|
Item | +The prepped item. | +
Raises:
+Type | +Description | +
---|---|
ConflictError | +If the item already exists in the database. | +
def sync_prep_create_item(
+ self,
+ item: stac_fastapi.types.stac.Item,
+ base_url: str,
+ exist_ok: bool = False
+) -> stac_fastapi.types.stac.Item
+
Prepare an item for insertion into the database.
+This method performs pre-insertion preparation on the given item
,
+such as checking if the collection the item belongs to exists,
+and optionally verifying that an item with the same ID does not already exist in the database.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +Item | +The item to be inserted into the database. | +None | +
base_url | +str | +The base URL used for constructing URLs for the item. | +None | +
exist_ok | +bool | +Indicates whether the item can exist already. | +None | +
Returns:
+Type | +Description | +
---|---|
Item | +The item after preparation is done. | +
Raises:
+Type | +Description | +
---|---|
NotFoundError | +If the collection that the item belongs to does not exist in the database. | +
ConflictError | +If an item with the same ID already exists in the collection. | +
def update_collection(
+ self,
+ collection_id: str,
+ collection: stac_fastapi.types.stac.Collection,
+ refresh: bool = False
+)
+
Update a collection from the database.
+Args: + self: The instance of the object calling this function. + collection_id (str): The ID of the collection to be updated. + collection (Collection): The Collection object to be used for the update.
+Raises:
+ NotFoundError: If the collection with the given collection_id
is not
+ found in the database.
Notes:
+ This function updates the collection in the database using the specified
+ collection_id
and with the collection specified in the Collection
object.
+ If the collection is not found, a NotFoundError
is raised.
class Geometry(
+ *args,
+ **kwargs
+)
+
Base class for protocol classes.
+Protocol classes are defined as::
+class Proto(Protocol):
+ def meth(self) -> int:
+ ...
+
Such classes are primarily used with static type checkers that recognize +structural subtyping (static duck-typing), for example::
+class C:
+ def meth(self) -> int:
+ return 0
+
+def func(x: Proto) -> int:
+ return x.meth()
+
+func(C()) # Passes static type check
+
See PEP 544 for details. Protocol classes decorated with
+library version.
+ + + + + + + + + + + + + +stac_fastapi.types.config module.
+class ApiSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7efc28aa7c30>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
ApiSettings.
+Defines api configuration, potentially through environment variables. +See pydantic-docs.helpmanual.io/usage/settings/.
+Name | +Type | +Description | +Default | +
---|---|---|---|
environment | +None | +name of the environment (ex. dev/prod). | +None | +
debug | +None | +toggles debug mode. | +None | +
forbidden_fields | +None | +set of fields defined by STAC but not included in the database. | +None | +
indexed_fields | +None | +set of fields which are usually in item.properties but are indexedas distinct columns in the database. |
+None | +
Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class Settings(
+ /,
+ *args,
+ **kwargs
+)
+
Holds the global instance of settings.
+def get(
+
+) -> stac_fastapi.types.config.ApiSettings
+
Get the settings.
+If they have not yet been set, throws an exception.
+def set(
+ base_settings: stac_fastapi.types.config.ApiSettings
+)
+
Set the global settings.
+ + + + + + + + + + + + + +Conformance Classes.
+BASE_CONFORMANCE_CLASSES
+
class OAFConformanceClasses(
+ /,
+ *args,
+ **kwargs
+)
+
Conformance classes for OGC API - Features.
+CORE
+
GEOJSON
+
OPEN_API
+
name
+
value
+
class STACConformanceClasses(
+ /,
+ *args,
+ **kwargs
+)
+
Conformance classes for the STAC API spec.
+COLLECTIONS
+
CORE
+
ITEM_SEARCH
+
OGC_API_FEAT
+
name
+
value
+
Base clients.
+BASE_CONFORMANCE_CLASSES
+
NumType
+
STAC_VERSION
+
StacType
+
api_settings
+
class AsyncBaseCoreClient(
+ stac_version: str = '1.0.0',
+ landing_page_id: str = 'stac-fastapi',
+ title: str = 'stac-fastapi',
+ description: str = 'stac-fastapi',
+ base_conformance_classes: List[str] = NOTHING,
+ extensions: List[stac_fastapi.types.extension.ApiExtension] = NOTHING,
+ post_request_model=<class 'stac_fastapi.types.search.BaseSearchPostRequest'>
+)
+
Defines a pattern for implementing STAC api core endpoints.
+Name | +Type | +Description | +Default | +
---|---|---|---|
extensions | +None | +list of registered api extensions. | +None | +
post_request_model
+
def all_collections(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.Collections
+
Get all available collections.
+Called with GET /collections
.
Returns:
+Type | +Description | +
---|---|
None | +A list of collections. | +
def conformance(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.Conformance
+
Conformance classes.
+Called with GET /conformance
.
Returns:
+Type | +Description | +
---|---|
None | +Conformance classes which the server conforms to. | +
def conformance_classes(
+ self
+) -> List[str]
+
Generate conformance classes by adding extension conformance to base
+conformance classes.
+def extension_is_enabled(
+ self,
+ extension: str
+) -> bool
+
Check if an api extension is enabled.
+def get_collection(
+ self,
+ collection_id: str,
+ **kwargs
+) -> stac_fastapi.types.stac.Collection
+
Get collection by id.
+Called with GET /collections/{collection_id}
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +Id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +Collection. | +
def get_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ **kwargs
+) -> stac_fastapi.types.stac.Item
+
Get item by id.
+Called with GET /collections/{collection_id}/items/{item_id}
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +None | +Id of the item. | +None | +
collection_id | +None | +Id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +Item. | +
def get_search(
+ self,
+ collections: Union[List[str], NoneType] = None,
+ ids: Union[List[str], NoneType] = None,
+ bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
+ datetime: Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType] = None,
+ limit: Union[int, NoneType] = 10,
+ query: Union[str, NoneType] = None,
+ token: Union[str, NoneType] = None,
+ fields: Union[List[str], NoneType] = None,
+ sortby: Union[str, NoneType] = None,
+ intersects: Union[str, NoneType] = None,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Cross catalog search (GET).
+Called with GET /search
.
Returns:
+Type | +Description | +
---|---|
None | +ItemCollection containing items which match the search criteria. | +
def item_collection(
+ self,
+ collection_id: str,
+ bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
+ datetime: Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType] = None,
+ limit: int = 10,
+ token: str = None,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Get all items from a specific collection.
+Called with GET /collections/{collection_id}/items
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +id of the collection. | +None | +
limit | +None | +number of items to return. | +None | +
token | +None | +pagination token. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +An ItemCollection. | +
def landing_page(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.LandingPage
+
Landing page.
+Called with GET /
.
Returns:
+Type | +Description | +
---|---|
None | +API landing page, serving as an entry point to the API. | +
def post_search(
+ self,
+ search_request: stac_fastapi.types.search.BaseSearchPostRequest,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Cross catalog search (POST).
+Called with POST /search
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search_request | +None | +search request parameters. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +ItemCollection containing items which match the search criteria. | +
class AsyncBaseFiltersClient(
+
+)
+
Defines a pattern for implementing the STAC filter extension.
+def get_queryables(
+ self,
+ collection_id: Union[str, NoneType] = None,
+ **kwargs
+) -> Dict[str, Any]
+
Get the queryables available for the given collection_id.
+If collection_id is None, returns the intersection of all queryables over all +collections.
+This base implementation returns a blank queryable schema. This is not allowed +under OGC CQL but it is allowed by the STAC API Filter Extension +github.com/radiantearth/stac-api-spec/tree/master/fragments/filter#queryables
+class AsyncBaseTransactionsClient(
+
+)
+
Defines a pattern for implementing the STAC transaction extension.
+def create_collection(
+ self,
+ collection: stac_fastapi.types.stac.Collection,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
+
Create a new collection.
+Called with POST /collections
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +None | +the collection | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The collection that was created. | +
def create_item(
+ self,
+ collection_id: str,
+ item: Union[stac_fastapi.types.stac.Item, stac_fastapi.types.stac.ItemCollection],
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
+
Create a new item.
+Called with POST /collections/{collection_id}/items
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +None | +the item or item collection | +None | +
collection_id | +None | +the id of the collection from the resource path | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The item that was created or None if item collection. | +
def delete_collection(
+ self,
+ collection_id: str,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
+
Delete a collection.
+Called with DELETE /collections/{collection_id}
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The deleted collection. | +
def delete_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
+
Delete an item from a collection.
+Called with DELETE /collections/{collection_id}/items/{item_id}
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +None | +id of the item. | +None | +
collection_id | +None | +id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The deleted item. | +
def update_collection(
+ self,
+ collection_id: str,
+ collection: stac_fastapi.types.stac.Collection,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
+
Perform a complete update on an existing collection.
+Called with PUT /collections/{collection_id}
. It is expected that this item
+already exists. The update should do a diff against the saved collection and
+perform any necessary updates. Partial updates are not supported by the
+transactions extension.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +id of the existing collection to be updated | +None | +
collection | +None | +the updated collection (must be complete) | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The updated collection. | +
def update_item(
+ self,
+ collection_id: str,
+ item_id: str,
+ item: stac_fastapi.types.stac.Item,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
+
Perform a complete update on an existing item.
+Called with PUT /collections/{collection_id}/items
. It is expected
+that this item already exists. The update should do a diff against the
+saved item and perform any necessary updates. Partial updates are not
+supported by the transactions extension.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +None | +the item (must be complete) | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The updated item. | +
class BaseCoreClient(
+ stac_version: str = '1.0.0',
+ landing_page_id: str = 'stac-fastapi',
+ title: str = 'stac-fastapi',
+ description: str = 'stac-fastapi',
+ base_conformance_classes: List[str] = NOTHING,
+ extensions: List[stac_fastapi.types.extension.ApiExtension] = NOTHING,
+ post_request_model=<class 'stac_fastapi.types.search.BaseSearchPostRequest'>
+)
+
Defines a pattern for implementing STAC api core endpoints.
+Name | +Type | +Description | +Default | +
---|---|---|---|
extensions | +None | +list of registered api extensions. | +None | +
post_request_model
+
def all_collections(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.Collections
+
Get all available collections.
+Called with GET /collections
.
Returns:
+Type | +Description | +
---|---|
None | +A list of collections. | +
def conformance(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.Conformance
+
Conformance classes.
+Called with GET /conformance
.
Returns:
+Type | +Description | +
---|---|
None | +Conformance classes which the server conforms to. | +
def conformance_classes(
+ self
+) -> List[str]
+
Generate conformance classes by adding extension conformance to base
+conformance classes.
+def extension_is_enabled(
+ self,
+ extension: str
+) -> bool
+
Check if an api extension is enabled.
+def get_collection(
+ self,
+ collection_id: str,
+ **kwargs
+) -> stac_fastapi.types.stac.Collection
+
Get collection by id.
+Called with GET /collections/{collection_id}
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +Id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +Collection. | +
def get_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ **kwargs
+) -> stac_fastapi.types.stac.Item
+
Get item by id.
+Called with GET /collections/{collection_id}/items/{item_id}
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +None | +Id of the item. | +None | +
collection_id | +None | +Id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +Item. | +
def get_search(
+ self,
+ collections: Union[List[str], NoneType] = None,
+ ids: Union[List[str], NoneType] = None,
+ bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
+ datetime: Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType] = None,
+ limit: Union[int, NoneType] = 10,
+ query: Union[str, NoneType] = None,
+ token: Union[str, NoneType] = None,
+ fields: Union[List[str], NoneType] = None,
+ sortby: Union[str, NoneType] = None,
+ intersects: Union[str, NoneType] = None,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Cross catalog search (GET).
+Called with GET /search
.
Returns:
+Type | +Description | +
---|---|
None | +ItemCollection containing items which match the search criteria. | +
def item_collection(
+ self,
+ collection_id: str,
+ bbox: Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType] = None,
+ datetime: Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType] = None,
+ limit: int = 10,
+ token: str = None,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Get all items from a specific collection.
+Called with GET /collections/{collection_id}/items
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +id of the collection. | +None | +
limit | +None | +number of items to return. | +None | +
token | +None | +pagination token. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +An ItemCollection. | +
def landing_page(
+ self,
+ **kwargs
+) -> stac_fastapi.types.stac.LandingPage
+
Landing page.
+Called with GET /
.
Returns:
+Type | +Description | +
---|---|
None | +API landing page, serving as an entry point to the API. | +
def list_conformance_classes(
+ self
+)
+
Return a list of conformance classes, including implemented extensions.
+def post_search(
+ self,
+ search_request: stac_fastapi.types.search.BaseSearchPostRequest,
+ **kwargs
+) -> stac_fastapi.types.stac.ItemCollection
+
Cross catalog search (POST).
+Called with POST /search
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
search_request | +None | +search request parameters. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +ItemCollection containing items which match the search criteria. | +
class BaseFiltersClient(
+
+)
+
Defines a pattern for implementing the STAC filter extension.
+def get_queryables(
+ self,
+ collection_id: Union[str, NoneType] = None,
+ **kwargs
+) -> Dict[str, Any]
+
Get the queryables available for the given collection_id.
+If collection_id is None, returns the intersection of all queryables over all +collections.
+This base implementation returns a blank queryable schema. This is not allowed +under OGC CQL but it is allowed by the STAC API Filter Extension +stac-api-extensions/filter#queryables
+class BaseTransactionsClient(
+
+)
+
Defines a pattern for implementing the STAC API Transaction Extension.
+def create_collection(
+ self,
+ collection: stac_fastapi.types.stac.Collection,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
+
Create a new collection.
+Called with POST /collections
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection | +None | +the collection | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The collection that was created. | +
def create_item(
+ self,
+ collection_id: str,
+ item: Union[stac_fastapi.types.stac.Item, stac_fastapi.types.stac.ItemCollection],
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
+
Create a new item.
+Called with POST /collections/{collection_id}/items
.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +None | +the item or item collection | +None | +
collection_id | +None | +the id of the collection from the resource path | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The item that was created or None if item collection. | +
def delete_collection(
+ self,
+ collection_id: str,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
+
Delete a collection.
+Called with DELETE /collections/{collection_id}
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The deleted collection. | +
def delete_item(
+ self,
+ item_id: str,
+ collection_id: str,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
+
Delete an item from a collection.
+Called with DELETE /collections/{collection_id}/items/{item_id}
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item_id | +None | +id of the item. | +None | +
collection_id | +None | +id of the collection. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The deleted item. | +
def update_collection(
+ self,
+ collection_id: str,
+ collection: stac_fastapi.types.stac.Collection,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Collection, starlette.responses.Response, NoneType]
+
Perform a complete update on an existing collection.
+Called with PUT /collections/{collection_id}
. It is expected that this
+collection already exists. The update should do a diff against the saved
+collection and perform any necessary updates. Partial updates are not
+supported by the transactions extension.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
collection_id | +None | +id of the existing collection to be updated | +None | +
collection | +None | +the updated collection (must be complete) | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The updated collection. | +
def update_item(
+ self,
+ collection_id: str,
+ item_id: str,
+ item: stac_fastapi.types.stac.Item,
+ **kwargs
+) -> Union[stac_fastapi.types.stac.Item, starlette.responses.Response, NoneType]
+
Perform a complete update on an existing item.
+Called with PUT /collections/{collection_id}/items
. It is expected
+that this item already exists. The update should do a diff against the
+saved item and perform any necessary updates. Partial updates are not
+supported by the transactions extension.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
item | +None | +the item (must be complete) | +None | +
collection_id | +None | +the id of the collection from the resource path | +None | +
Returns:
+Type | +Description | +
---|---|
None | +The updated item. | +
class LandingPageMixin(
+ stac_version: str = '1.0.0',
+ landing_page_id: str = 'stac-fastapi',
+ title: str = 'stac-fastapi',
+ description: str = 'stac-fastapi'
+)
+
Create a STAC landing page (GET /).
+stac_fastapi.types.errors module.
+class ConflictError(
+ /,
+ *args,
+ **kwargs
+)
+
Database conflict.
+args
+
def with_traceback(
+ ...
+)
+
Exception.with_traceback(tb) --
+set self.traceback to tb and return self.
+class DatabaseError(
+ /,
+ *args,
+ **kwargs
+)
+
Generic database errors.
+args
+
def with_traceback(
+ ...
+)
+
Exception.with_traceback(tb) --
+set self.traceback to tb and return self.
+class ForeignKeyError(
+ /,
+ *args,
+ **kwargs
+)
+
Foreign key error (collection does not exist).
+args
+
def with_traceback(
+ ...
+)
+
Exception.with_traceback(tb) --
+set self.traceback to tb and return self.
+class InvalidQueryParameter(
+ /,
+ *args,
+ **kwargs
+)
+
Error for unknown or invalid query parameters.
+Used to capture errors that should respond according to +docs.opengeospatial.org/is/17-069r3/17-069r3.html#query_parameters
+args
+
def with_traceback(
+ ...
+)
+
Exception.with_traceback(tb) --
+set self.traceback to tb and return self.
+class NotFoundError(
+ /,
+ *args,
+ **kwargs
+)
+
Resource not found.
+args
+
def with_traceback(
+ ...
+)
+
Exception.with_traceback(tb) --
+set self.traceback to tb and return self.
+class StacApiError(
+ /,
+ *args,
+ **kwargs
+)
+
Generic API error.
+args
+
def with_traceback(
+ ...
+)
+
Exception.with_traceback(tb) --
+set self.traceback to tb and return self.
+ + + + + + + + + + + + + +Base api extension.
+class ApiExtension(
+ conformance_classes: List[str] = NOTHING,
+ schema_href: Union[str, NoneType] = None
+)
+
Abstract base class for defining API extensions.
+GET
+
POST
+
def get_request_model(
+ self,
+ verb: Union[str, NoneType] = 'GET'
+) -> Union[pydantic.main.BaseModel, NoneType]
+
Return the request model for the extension.method.
+The model can differ based on HTTP verb
+def register(
+ self,
+ app: fastapi.applications.FastAPI
+) -> None
+
Register the extension with a FastAPI application.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
app | +None | +target FastAPI application. | +None | +
Returns:
+Type | +Description | +
---|---|
None | +None | +
Backend submodule.
+Link helpers.
+INFERRED_LINK_RELS
+
def filter_links(
+ links: List[Dict]
+) -> List[Dict]
+
Remove inferred links.
+def resolve_links(
+ links: list,
+ base_url: str
+) -> List[Dict]
+
Convert relative links to absolute links.
+class BaseLinks(
+ collection_id: str,
+ base_url: str
+)
+
Create inferred links common to collections and items.
+def root(
+ self
+) -> Dict[str, Any]
+
Return the catalog root.
+class CollectionLinks(
+ collection_id: str,
+ base_url: str
+)
+
Create inferred links specific to collections.
+def create_links(
+ self
+) -> List[Dict[str, Any]]
+
Return all inferred links.
+def items(
+ self
+) -> Dict[str, Any]
+
Create the items
link.
def parent(
+ self
+) -> Dict[str, Any]
+
Create the parent
link.
def root(
+ self
+) -> Dict[str, Any]
+
Return the catalog root.
+def self(
+ self
+) -> Dict[str, Any]
+
Create the self
link.
class ItemLinks(
+ collection_id: str,
+ base_url: str,
+ item_id: str
+)
+
Create inferred links specific to items.
+def collection(
+ self
+) -> Dict[str, Any]
+
Create the collection
link.
def create_links(
+ self
+) -> List[Dict[str, Any]]
+
Return all inferred links.
+def parent(
+ self
+) -> Dict[str, Any]
+
Create the parent
link.
def root(
+ self
+) -> Dict[str, Any]
+
Return the catalog root.
+def self(
+ self
+) -> Dict[str, Any]
+
Create the self
link.
rfc3339.
+DateTimeType
+
RFC33339_PATTERN
+
def now_in_utc(
+
+) -> datetime.datetime
+
Return a datetime value of now with the UTC timezone applied.
+def now_to_rfc3339_str(
+
+) -> str
+
Return an RFC 3339 string representing now.
+def parse_single_date(
+ date_str: str
+) -> datetime.datetime
+
Parse a single RFC3339 date string into a datetime object.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
date_str | +str | +A string representing the date in RFC3339 format. | +None | +
Returns:
+Type | +Description | +
---|---|
datetime | +A datetime object parsed from the date_str. | +
Raises:
+Type | +Description | +
---|---|
ValueError | +If the date_str is empty or contains the placeholder '..'. | +
def rfc3339_str_to_datetime(
+ s: str
+) -> datetime.datetime
+
Convert a string conforming to RFC 3339 to a :class:datetime.datetime
.
Uses :meth:iso8601.parse_date
under the hood.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
s | +str | +The string to convert to :class:datetime.datetime . |
+None | +
Returns:
+Type | +Description | +
---|---|
str | +The datetime represented by the ISO8601 (RFC 3339) formatted string. | +
Raises:
+Type | +Description | +
---|---|
ValueError | +If the string is not a valid RFC 3339 string. | +
def str_to_interval(
+ interval: Union[str, NoneType]
+) -> Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime], NoneType]
+
Extract a tuple of datetime objects from an interval string defined by the OGC API.
+The interval can either be a single datetime or a range with start and end datetime.
+Args: + interval (Optional[str]): The interval string to convert to datetime objects, + or None if no datetime is specified.
+Returns: + Optional[DateTimeType]: A tuple of datetime.datetime objects or + None if input is None.
+Raises: + HTTPException: If the string is not valid for various reasons such as being empty, + having more than one slash, or if date formats are invalid.
+ + + + + + + + + + + + + +stac_fastapi.types.search module.
+NumType
+
def str2bbox(
+ x: str
+) -> Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType]
+
Convert string to BBox based on , delimiter.
+def str2list(
+ x: str
+) -> Union[List, NoneType]
+
Convert string to list base on , delimiter.
+class APIRequest(
+
+)
+
Generic API Request base class.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class BaseSearchGetRequest(
+ collections: str = None,
+ ids: str = None,
+ bbox: str = None,
+ intersects: Union[str, NoneType] = None,
+ datetime: Union[str, NoneType] = None,
+ limit: Union[int, NoneType] = 10
+)
+
Base arguments for GET Request.
+def kwargs(
+ self
+) -> Dict
+
Transform api request params into format which matches the signature of the
+endpoint.
+class BaseSearchPostRequest(
+ __pydantic_self__,
+ **data: Any
+)
+
Search model.
+Replace base model in STAC-pydantic as it includes additional fields, not in the core +model. +github.com/radiantearth/stac-api-spec/tree/master/item-search#query-parameter-table
+PR to fix this: +stac-utils/stac-pydantic!100
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def validate_bbox(
+ v: Union[str, Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
+) -> Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
+
Check order of supplied bbox coordinates.
+def validate_datetime(
+ v: Union[str, datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
+) -> Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
+
Parse datetime.
+def validate_spatial(
+ v,
+ values
+)
+
Check bbox and intersects are not both supplied.
+end_date
+
Extract the end date from the datetime string.
+spatial_filter
+
Return a geojson-pydantic object representing the spatial filter for the search
+request.
+Check for both because the bbox
and intersects
parameters are
+mutually exclusive.
start_date
+
Extract the start date from the datetime string.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class Limit(
+ /,
+ *args,
+ **kwargs
+)
+
An positive integer that maxes out at 10,000.
+denominator
+
ge
+
gt
+
imag
+
le
+
lt
+
multiple_of
+
numerator
+
real
+
strict
+
def validate(
+ value: int
+) -> int
+
Validate the integer value.
+def as_integer_ratio(
+ self,
+ /
+)
+
Return integer ratio.
+Return a pair of integers, whose ratio is exactly equal to the original int +and with a positive denominator.
+++++++(10).as_integer_ratio() +(10, 1) +(-10).as_integer_ratio() +(-10, 1) +(0).as_integer_ratio() +(0, 1)
+
def bit_length(
+ self,
+ /
+)
+
Number of bits necessary to represent self in binary.
+++++++bin(37) +'0b100101' +(37).bit_length() +6
+
def conjugate(
+ ...
+)
+
Returns self, the complex conjugate of any int.
+def from_bytes(
+ bytes,
+ byteorder,
+ *,
+ signed=False
+)
+
Return the integer represented by the given array of bytes.
+bytes + Holds the array of bytes to convert. The argument must either + support the buffer protocol or be an iterable object producing bytes. + Bytes and bytearray are examples of built-in objects that support the + buffer protocol. +byteorder + The byte order used to represent the integer. If byteorder is 'big', + the most significant byte is at the beginning of the byte array. If + byteorder is 'little', the most significant byte is at the end of the + byte array. To request the native byte order of the host system, use + `sys.byteorder' as the byte order value. +signed + Indicates whether two's complement is used to represent the integer.
+def to_bytes(
+ self,
+ /,
+ length,
+ byteorder,
+ *,
+ signed=False
+)
+
Return an array of bytes representing an integer.
+length + Length of bytes object to use. An OverflowError is raised if the + integer is not representable with the given number of bytes. +byteorder + The byte order used to represent the integer. If byteorder is 'big', + the most significant byte is at the beginning of the byte array. If + byteorder is 'little', the most significant byte is at the end of the + byte array. To request the native byte order of the host system, use + `sys.byteorder' as the byte order value. +signed + Determines whether two's complement is used to represent the integer. + If signed is False and a negative integer is given, an OverflowError + is raised.
+class Operator(
+ /,
+ *args,
+ **kwargs
+)
+
Defines the set of operators supported by the API.
+eq
+
gt
+
gte
+
lt
+
lte
+
ne
+
STAC types.
+NumType
+
class Catalog(
+ /,
+ *args,
+ **kwargs
+)
+
STAC Catalog.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class Collection(
+ /,
+ *args,
+ **kwargs
+)
+
STAC Collection.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class Collections(
+ /,
+ *args,
+ **kwargs
+)
+
All collections endpoint.
+github.com/radiantearth/stac-api-spec/tree/master/collections
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class Conformance(
+ /,
+ *args,
+ **kwargs
+)
+
STAC Conformance Classes.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class Item(
+ /,
+ *args,
+ **kwargs
+)
+
STAC Item.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class ItemCollection(
+ /,
+ *args,
+ **kwargs
+)
+
STAC Item Collection.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class LandingPage(
+ /,
+ *args,
+ **kwargs
+)
+
STAC Landing Page.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+ + + + + + + + + + + + + +Library version.
+ + + + + + + + + + + + + +