service
¶
Classes:
-
GeocodeService–Service to get Information from
Attributes:
Attributes¶
Classes¶
GeocodeService
¶
Service to get Information from Nominatim.
Note
This is not used to get huts, rather to get additional info (like location) from huts.
Classes:
-
MethodNotImplementedError–Method is not implemented exception.
Methods:
-
clear_all_cache–Clears the cache of all services!
-
get_huts_from_source–Get all huts from source.
-
get_huts–Get all huts form source and converts them.
-
get_bookings–Get bookings for a list of huts.
-
get_location_by_name–Get location (coordinates) from a name (uses 'https://nominatim.openstreetmap.org).
-
get_elevations–Get elevations from a list of locations (coordinates) (uses 'https://open-elevation.com).
-
get_elevation–Get elevation from a location (coordinates) (uses 'https://open-elevation.com).
-
convert–
Attributes:
-
support_bbox(bool) – -
support_limit(bool) – -
support_offset(bool) – -
support_convert(bool) – -
support_booking(bool) – -
loc_request_url– -
ele_request_url– -
httpx_client–
Attributes¶
loc_request_url
instance-attribute
¶
ele_request_url
instance-attribute
¶
Classes¶
MethodNotImplementedError
¶
MethodNotImplementedError(obj: BaseService, method: str)
Method is not implemented exception.
Parameters:
-
(obj¶BaseService) –Service object (e.g.
MyService). -
(method¶str) –Method which is not implemented.
Functions¶
Functions¶
get_huts_from_source
¶
get_huts
¶
get_huts(
bbox: BBox | None = None,
limit: int = 1,
offset: int = 0,
include_photos: bool = True,
**kwargs: Any,
) -> list[HutSchema]
Get all huts form source and converts them.
Calls get_huts_from_source()
and convert().
Returns:
-
list[HutSchema]–Converted huts from source.
get_bookings
¶
get_bookings(
date: datetime | date | Literal["now"] | None = None,
days: int | None = None,
source_ids: list[int | str] | None = None,
lang: str = "de",
request_interval: float | None = None,
) -> dict[int | str, HutBookingsSchema]
Get bookings for a list of huts.
Parameters:
-
(date¶datetime | date | Literal['now'] | None, default:None) –Start daye for the bookings
-
(days¶int | None, default:None) –Duration in days
-
(source_ids¶list[int | str] | None, default:None) –A list of ids to return (source id, not the hut id), if set to
Noneall are returned -
(lang¶str, default:'de') –Language for the response
-
(request_interval¶float | None, default:None) –Interval between requests (if each huts needs a request)
Returns:
-
dict[int | str, HutBookingsSchema]–A dictionary with the bookings (key = source id).
get_location_by_name
¶
get_location_by_name(
name: str, client: Client | None = None
) -> LocationEleSchema | None
Get location (coordinates) from a name (uses 'https://nominatim.openstreetmap.org).
get_elevations
¶
get_elevations(
locations: Sequence[LocationSchema | LocationEleSchema],
client: Client | None = None,
) -> list[LocationEleSchema]
Get elevations from a list of locations (coordinates) (uses 'https://open-elevation.com).
get_elevation
¶
get_elevation(
location: LocationSchema | LocationEleSchema,
client: Client | None = None,
) -> LocationEleSchema
Get elevation from a location (coordinates) (uses 'https://open-elevation.com).