service
¶
Camptocamp.org service for retrieving hut data.
Classes:
-
CamptocampService–Service to get huts from Camptocamp.org
Functions:
-
camptocamp_detail_request–Request detailed information for a specific hut from Camptocamp API.
-
camptocamp_request–Request huts from Camptocamp API.
Attributes:
Attributes¶
Classes¶
CamptocampService
¶
Service to get huts from Camptocamp.org using their API.
Note
The methods are described in BaseService.
Classes:
-
MethodNotImplementedError–Method is not implemented exception.
Methods:
-
clear_all_cache–Clears the cache of all services!
-
get_huts–Get all huts form source and converts them.
-
get_bookings–Get bookings for a list of huts.
-
get_huts_from_source–Get huts from Camptocamp API.
-
convert–Convert CamptocampHutSource to HutSchema.
Attributes:
-
support_bbox(bool) – -
support_limit(bool) – -
support_offset(bool) – -
support_convert(bool) – -
support_booking(bool) – -
request_url–
Attributes¶
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
¶
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,
total_fallback: TotalFallback
| Mapping[int | str, TotalFallback]
| 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)
-
(total_fallback¶TotalFallback | Mapping[int | str, TotalFallback] | None, default:None) –Caller-provided totals that may OVERWRITE scraped page totals — a single
TotalFallbackfor all huts or a per-hut mapping keyed by source id (int or str) / slug. Priority: booking-service total > this fallback > hut detail. Sources that publish their own totals ignore it; the field also lands inPlacesSchema.total_fallbackfor consumers.
Returns:
-
dict[int | str, HutBookingsSchema]–A dictionary with the bookings (key = source id).
get_huts_from_source
¶
get_huts_from_source(
bbox: BBox | None = None,
limit: int = 100,
offset: int = 0,
fetch_details: bool = True,
request_interval: float = 0.5,
**kwargs: Any,
) -> list[CamptocampHutSource]
Get huts from Camptocamp API.
Parameters:
-
(bbox¶BBox | None, default:None) –Bounding box for geographic filtering
-
(limit¶int, default:100) –Maximum number of results
-
(offset¶int, default:0) –Offset for pagination
-
(fetch_details¶bool, default:True) –Whether to fetch detailed information for each hut
-
(request_interval¶float, default:0.5) –Delay in seconds between detail requests (to be nice to the API)
-
(**kwargs¶Any, default:{}) –Additional parameters
Returns:
-
list[CamptocampHutSource]–List of CamptocampHutSource objects
convert
¶
convert(
src: Mapping | Any, include_photos: bool = True
) -> HutSchema
Functions¶
camptocamp_detail_request
¶
camptocamp_detail_request(
url: str, document_id: int, **params: Any
) -> CamptocampDocument | None
Request detailed information for a specific hut from Camptocamp API.
Parameters:
-
(url¶str) –Base API URL (without document ID)
-
(document_id¶int) –The document ID to fetch
-
(**params¶Any, default:{}) –Additional query parameters
Returns:
-
CamptocampDocument | None–CamptocampDocument with detailed information or None if failed
camptocamp_request
¶
camptocamp_request(
url: str,
waypoint_type: str = "hut",
limit: int | None = None,
offset: int = 0,
bbox: BBox | None = None,
**params: Any,
) -> CamptocampApiResponse
Request huts from Camptocamp API.
Parameters:
-
(url¶str) –Base API URL
-
(waypoint_type¶str, default:'hut') –Type of waypoint to fetch (default: "hut")
-
(limit¶int | None, default:None) –Maximum number of results
-
(offset¶int, default:0) –Offset for pagination
-
(bbox¶BBox | None, default:None) –Bounding box for geographic filtering
-
(**params¶Any, default:{}) –Additional query parameters
Returns:
-
CamptocampApiResponse–CamptocampApiResponse with documents