calendaring_jmap.session module#
JMAP session establishment (RFC 8620 Section 2).
Fetches the Session object from /.well-known/jmap and extracts the information needed to make subsequent API calls.
- class calendaring_jmap.session.Session(api_url, account_id, state, account_capabilities=dict(), server_capabilities=dict(), upload_url=None, download_url=None, raw=dict())[source]#
Bases:
objectParsed JMAP Session object (RFC 8620 Section 2).
- Variables:
api_url (
str) – URL to POST method calls to.account_id (
str) – The accountId to use for calendar method calls. Chosen fromprimaryAccountsif available, otherwise the first account advertising the calendars capability.state (
str) – Current session state string.account_capabilities (
dict) – Capabilities dict for the chosen account.server_capabilities (
dict) – Server-level capabilities dict.upload_url (
str|None) – URI Template (RFC 8620 Section 6.1) for uploading a blob, orNoneif the server omits it.download_url (
str|None) – URI Template (RFC 8620 Section 6.2) for downloading a blob, orNoneif the server omits it.raw (
dict) – The full parsed Session JSON for anything not captured above.
- async calendaring_jmap.session.async_fetch_session(url, auth, timeout=30)[source]#
Async variant of
fetch_session()using niquests.AsyncSession.- Parameters:
url (
str) – Full URL to the JMAP session endpoint.auth – A niquests-compatible auth object.
- Return type:
- Returns:
Parsed
Sessionwithapi_urlandaccount_idset.- Raises:
JMAPAuthError – If the server returns HTTP 401 or 403.
JMAPCapabilityError – If no account advertises the calendars capability.
- calendaring_jmap.session.fetch_session(url, auth, timeout=30)[source]#
Fetch and parse the JMAP Session object.
Performs a GET request to
url(expected to be/.well-known/jmapor equivalent), authenticates withauth, and returns a parsedSession.- Parameters:
url (
str) – Full URL to the JMAP session endpoint.auth – A requests-compatible auth object (e.g. HTTPBasicAuth, HTTPBearerAuth).
- Return type:
- Returns:
Parsed
Sessionwithapi_urlandaccount_idset.- Raises:
JMAPAuthError – If the server returns HTTP 401 or 403.
JMAPCapabilityError – If no account advertises the calendars capability.
requests.HTTPError – For other non-2xx responses.