Module stac_fastapi.api.routes¶
Route factories.
Variables¶
HTTP_204_NO_CONTENT
Functions¶
add_route_dependencies¶
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.
"*" can be used for path or method to match all allowed routes.
Returns:
Type | Description |
---|---|
None | None |
create_async_endpoint¶
def create_async_endpoint(
func: Callable,
request_model: Union[Type[stac_fastapi.types.search.APIRequest], Type[pydantic.main.BaseModel], Dict]
)
Wrap a function in a coroutine which may be used to create a FastAPI endpoint.
Synchronous functions are executed asynchronously using a background thread.
sync_to_async¶
def sync_to_async(
func
)
Run synchronous function asynchronously in a background thread.
Classes¶
Scope¶
class Scope(
/,
*args,
**kwargs
)
More strict version of Starlette's Scope.
Ancestors (in MRO)¶
- builtins.dict
Methods¶
clear¶
def clear(
...
)
D.clear() -> None. Remove all items from D.
copy¶
def copy(
...
)
D.copy() -> a shallow copy of D
fromkeys¶
def fromkeys(
iterable,
value=None,
/
)
Create a new dictionary with keys from iterable and values set to value.
get¶
def get(
self,
key,
default=None,
/
)
Return the value for key if key is in the dictionary, else default.
items¶
def items(
...
)
D.items() -> a set-like object providing a view on D's items
keys¶
def keys(
...
)
D.keys() -> a set-like object providing a view on D's keys
pop¶
def pop(
...
)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem¶
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.
setdefault¶
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.
update¶
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]
values¶
def values(
...
)
D.values() -> an object providing a view on D's values