Endpoints adapters (Domains)¶
Endpoints are grouped under tags which represent a domain exposed by the API.
Calendar API exposes 3 domains:
- Holidays: Holidays related operations
- Bdays: Business Days related operations
- Tagged Calendar: Both of them merged, every day tagged with its kind. This is the whole calendar
In the client side, the domains are represented as Resource adapters
BaseMixin
¶
BaseMixin(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Mixin Base class for resource-interaction with Calendar API.
Attributes:
-
resource_name(str) –Resource canonical name
-
model_type(ModelT) –Default model class of an endpoint
-
endpoints(dict) –A mapping of operation keys and endpoint URLS. Each operation has a unique key in the dict
Methods:
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
HolidaysResource
¶
HolidaysResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Methods:
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
is_holiday–Verify if the provided date is a Holiday. If True, also returns the description of that Holiday and its type.
-
json_from_response_or_raise–Extract the json payload from the Response.
-
year–Get the holidays of a year
-
years–Get the holidays of many years
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
is_holiday
¶
is_holiday(date: date) -> HolidayCheckResult
Verify if the provided date is a Holiday. If True, also returns the description of that Holiday and its type.
Parameters:
Returns:
-
HolidayCheckResult(HolidayCheckResult) –Result of the verification
Source code in pycalendar_api/domains/holidays.py
65 66 67 68 69 70 71 72 73 74 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
year
¶
year(year: int, *, holiday_type: CalHolidayType = None) -> list[Holiday]
Get the holidays of a year
Parameters:
-
(year¶int) –the Year
-
(holiday_type¶`CalHolidayType`, default:None) –Optional filter on holiday type. See
CalHolidayType
Returns:
Source code in pycalendar_api/domains/holidays.py
41 42 43 44 45 46 47 48 49 50 51 | |
years
¶
years(years: Iterable[int], *, holiday_type: CalHolidayType = None) -> list[Holiday]
Get the holidays of many years
Parameters:
-
(years¶Iterable[int]) –Iterable of years as int
-
(holiday_type¶`CalHolidayType`, default:None) –Optional filter on holiday type. See
CalHolidayType
Returns:
Source code in pycalendar_api/domains/holidays.py
53 54 55 56 57 58 59 60 61 62 63 | |
BDaysResource
¶
BDaysResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Methods:
-
bdays_of–Get the Business days of a year.
-
between–Get the Business days between 2 dates
-
count–Count the business days (inclusive) between 2 dates
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
-
next_date–Returns the
nextBusiness day following the provided date -
previous_date–Returns the
previousBusiness day before the provided date -
span–Get the Start/End dates of periods (Quarters, Semesters, Months) in the form of ]
Start,End] (Open-Close Interval).
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
bdays_of
¶
Get the Business days of a year.
Parameters:
-
(year¶int) –the year
-
(month¶int, default:None) –If provided returns the business days of that month
Returns:
-
DateSeries(DateSeries) –Ordered Set of dates. The collection is under
DateSeries.serie
Source code in pycalendar_api/domains/bdays.py
81 82 83 84 85 86 87 88 89 90 91 | |
between
¶
Get the Business days between 2 dates
Parameters:
Returns:
-
DateSeries(DateSeries) –Ordered Set of dates. The collection is under
DateSeries.serie
Source code in pycalendar_api/domains/bdays.py
69 70 71 72 73 74 75 76 77 78 79 | |
count
¶
Count the business days (inclusive) between 2 dates
Parameters:
Returns:
-
DaysCount(DaysCount) –Days count datastruct
Source code in pycalendar_api/domains/bdays.py
93 94 95 96 97 98 99 100 101 102 103 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
next_date
¶
Returns the next Business day following the provided date
Parameters:
Returns:
-
NextDate(NextDate) –Contains the requested date and the next open date
Source code in pycalendar_api/domains/bdays.py
105 106 107 108 109 110 111 112 113 114 | |
previous_date
¶
previous_date(date: date) -> PreviousDate
Returns the previous Business day before the provided date
Parameters:
Returns:
-
PreviousDate(PreviousDate) –Contains the requested date and the previous open date
Source code in pycalendar_api/domains/bdays.py
116 117 118 119 120 121 122 123 124 125 | |
span
¶
Get the Start/End dates of periods (Quarters, Semesters, Months) in the form of ]Start, End] (Open-Close Interval).
-
Start: The last Open Business day of the previous period -
End: The last Open Business day of the period
Parameters:
-
(year¶int) –Span of a year
-
(month¶int, default:None) –Span of a month, 1 <= month <= 12
-
(quarter¶int, default:None) –Span of a quarter, 1 <= quarter <= 4
-
(semester¶int, default:None) –Span of a semester, 1 <= semester <= 2
Returns:
-
CalSpan(CalSpan) –Span interval of the requested period
Raises:
-
CalendarAPIParamError–Only one of the periods must be provided.
Source code in pycalendar_api/domains/bdays.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
TaggedCalendarResource
¶
TaggedCalendarResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Methods:
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
-
month–Get one month of the tagged calendar laid out in ISO weeks (Monday → Sunday), with the days counts by kind.
-
year–Get the full calendar of a year, month by month, where every day is tagged
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
month
¶
month(year: int, month: int) -> TaggedMonth
Get one month of the tagged calendar laid out in ISO weeks (Monday → Sunday), with the days counts by kind.
Parameters:
Returns:
-
TaggedMonth(TaggedMonth) –The weeks of the month and the days counts by kind
Source code in pycalendar_api/domains/tagged.py
37 38 39 40 41 42 43 44 45 46 47 | |
year
¶
year(year: int) -> TaggedYear
Get the full calendar of a year, month by month, where every day is tagged
BUSINESS, WEEKEND or HOLIDAY (with its type, status and description).
Parameters:
Returns:
-
TaggedYear(TaggedYear) –The months of the year and the days counts by kind
Source code in pycalendar_api/domains/tagged.py
25 26 27 28 29 30 31 32 33 34 35 | |
HealthsResource
¶
HealthsResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Methods:
-
api–Check the health of the API. Serves as a heartbeat for integrations.
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
api
¶
api() -> ApiHealth
Check the health of the API. Serves as a heartbeat for integrations.
Returns:
-
ApiHealth(ApiHealth) –Health Status of the API
Source code in pycalendar_api/domains/health.py
21 22 23 24 25 26 27 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
Async resources¶
AsyncCalendarApi uses the async counterparts of the resources above. They share the same requests (ApiCall) and the same models.
ApiCall
dataclass
¶
Description of a GET request to the API and how to deserialize its response.
Built once by the resource operations and executed by either the sync or the async client.
Attributes:
-
url(str) –Endpoint URL, relative to the client
base_urlor absolute -
params(dict) –Query parameters
-
model_type(ModelT) –Model class used for deserialization
-
many(bool) –The response is a list of
model_type
AsyncHolidaysResource
¶
AsyncHolidaysResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Async version of HolidaysResource. Same operations, to be awaited.
Methods:
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
is_holiday–Verify if the provided date is a Holiday. See
HolidaysResource.is_holiday -
json_from_response_or_raise–Extract the json payload from the Response.
-
year–Get the holidays of a year. See
HolidaysResource.year -
years–Get the holidays of many years. See
HolidaysResource.years
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
is_holiday
async
¶
is_holiday(date: date) -> HolidayCheckResult
Verify if the provided date is a Holiday. See HolidaysResource.is_holiday
Source code in pycalendar_api/domains/holidays.py
88 89 90 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
year
async
¶
year(year: int, *, holiday_type: CalHolidayType = None) -> list[Holiday]
Get the holidays of a year. See HolidaysResource.year
Source code in pycalendar_api/domains/holidays.py
80 81 82 | |
years
async
¶
years(years: Iterable[int], *, holiday_type: CalHolidayType = None) -> list[Holiday]
Get the holidays of many years. See HolidaysResource.years
Source code in pycalendar_api/domains/holidays.py
84 85 86 | |
AsyncBDaysResource
¶
AsyncBDaysResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Async version of BDaysResource. Same operations, to be awaited.
Methods:
-
bdays_of–Get the Business days of a year or a month. See
BDaysResource.bdays_of -
between–Get the Business days between 2 dates. See
BDaysResource.between -
count–Count the business days (inclusive) between 2 dates. See
BDaysResource.count -
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
-
next_date–Returns the
nextBusiness day following the provided date. SeeBDaysResource.next_date -
previous_date–Returns the
previousBusiness day before the provided date. SeeBDaysResource.previous_date -
span–Get the Start/End dates of periods. See
BDaysResource.span
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
bdays_of
async
¶
Get the Business days of a year or a month. See BDaysResource.bdays_of
Source code in pycalendar_api/domains/bdays.py
157 158 159 | |
between
async
¶
Get the Business days between 2 dates. See BDaysResource.between
Source code in pycalendar_api/domains/bdays.py
153 154 155 | |
count
async
¶
Count the business days (inclusive) between 2 dates. See BDaysResource.count
Source code in pycalendar_api/domains/bdays.py
161 162 163 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
next_date
async
¶
Returns the next Business day following the provided date. See BDaysResource.next_date
Source code in pycalendar_api/domains/bdays.py
165 166 167 | |
previous_date
async
¶
previous_date(date: date) -> PreviousDate
Returns the previous Business day before the provided date. See BDaysResource.previous_date
Source code in pycalendar_api/domains/bdays.py
169 170 171 | |
span
async
¶
Get the Start/End dates of periods. See BDaysResource.span
Raises:
-
CalendarAPIParamError–Only one of the periods must be provided.
Source code in pycalendar_api/domains/bdays.py
174 175 176 177 178 179 180 | |
AsyncTaggedCalendarResource
¶
AsyncTaggedCalendarResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Async version of TaggedCalendarResource. Same operations, to be awaited.
Methods:
-
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
-
month–Get one month of the tagged calendar. See
TaggedCalendarResource.month -
year–Get the full tagged calendar of a year. See
TaggedCalendarResource.year
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
month
async
¶
month(year: int, month: int) -> TaggedMonth
Get one month of the tagged calendar. See TaggedCalendarResource.month
Source code in pycalendar_api/domains/tagged.py
57 58 59 | |
year
async
¶
year(year: int) -> TaggedYear
Get the full tagged calendar of a year. See TaggedCalendarResource.year
Source code in pycalendar_api/domains/tagged.py
53 54 55 | |
AsyncHealthsResource
¶
AsyncHealthsResource(client: Client | AsyncClient, endpoints: dict = None, **kwargs)
Async version of HealthsResource
Methods:
-
api–Check the health of the API. See
HealthsResource.api -
endpoint_by_operation–Retrieve the endpoint URL from the deined method key in URLS (self.endpoints)
-
host_url–Returns the host url from the client.
self.client.base_urlcontains the/api/v1path to ease the definition of operation keys. -
json_from_response_or_raise–Extract the json payload from the Response.
Source code in pycalendar_api/domains/base.py
47 48 49 50 51 52 53 54 | |
api
async
¶
api() -> ApiHealth
Check the health of the API. See HealthsResource.api
Source code in pycalendar_api/domains/health.py
33 34 35 | |
endpoint_by_operation
¶
Retrieve the endpoint URL from the deined method key in URLS (self.endpoints) the key is in the form of {self.resource_name}:{method}.
Parameters:
Returns:
-
str(str) –Endpoint URL
Raises:
-
CalendarAPIParamError–Method not defined
Source code in pycalendar_api/domains/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
host_url
¶
host_url() -> str
Returns the host url from the client. self.client.base_url contains the /api/v1 path to ease the definition of operation keys.
Source code in pycalendar_api/domains/base.py
75 76 77 78 | |
json_from_response_or_raise
staticmethod
¶
Extract the json payload from the Response.
Parameters:
-
(response¶Response) –httpx Response
-
(error_key¶(str, detail), default:'detail') –Error key name in the Json body
Returns:
-
dict(dict) –Json extracted from the response
Raises:
-
CalendarAPIAuthError–If the HTTP response status is 401 or 403
-
CalendarAPIClientError–If the HTTP response status is >= 400 or the body is not a valid Json
Source code in pycalendar_api/domains/base.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |