Asite
Client for the Asite Document Management API.
Asite uses a session-based auth flow: a long-lived {emailId, password}
credential lives in Key Vault, and is exchanged at the /apilogin/
endpoint for a short-lived ASessionID that gets injected as a header
on every subsequent call. AsiteClient owns the credential lifecycle;
AsiteSessionAuthProvider is the Kiota-side glue that injects the
session ID into outgoing Kiota requests.
Beyond auth, the client also exposes three high-level read methods
(list_workspaces, list_folders, list_documents) that wrap the
XML APIs and return ordinary Python dicts. All three memoise per-instance
for the lifetime of the session — Asite's session-scoped IDs make
re-walking the workspace→folder→doclist tree expensive to do per file,
and the connector binds many files at once.
AsiteClient
Bases: BaseSessionAuthClient
Manages Asite session-ID lifecycle and exposes high-level read APIs.
Stored credentials in Key Vault are a JSON object:
{"emailId": "user@example.com", "password": "..."}
Attributes:
| Name | Type | Description |
|---|---|---|
user_id |
Unique ID for the Hoppa user, used to scope the KeyVault secret. |
create_url_generator
create_url_generator(workspace_name, folder_path, file_name)
Closure that re-mints the signed URL on demand.
Mirrors SharePointClient.create_url_generator. The closure
delegates to :meth:resolve_download_uri, which validates the
session (re-logging in if stale) and returns a fresh URL.
Pass the result as url_generator= to
AzureBlobDocumentVersion; the base SignedEntity machinery
calls it whenever the cached URL has aged past its TTL.
invalidate_session
invalidate_session()
Clear the cached session ID and all derived per-session caches.
list_documents
list_documents(doclist_uri, *, share_links=True, expiry='10h')
Documents in a folder, optionally with public share links.
Each entry
file_name:FileName(stable, human-readable)file_name_display:FileNameDisplayfolder_path:FolderPath(backslash-separated, includes workspace name as prefix and file name as suffix)size_bytes/size_human: parsed from the twoFileSizeelements (Asite emits both, in that order).document_id/document_id_prefixrevision_id/revision_id_prefixrevision_no,doc_ref,doc_title,issue_nopublisher_name,publisher_org,published_date(ISO)share_link: publicadoddle.asite.com/lnk/URL orNoneif the folder doesn't have "Enable Public Links" ondownload_uri: session-authenticated download URI (always present, fallback when share link unavailable)raw: fulldocumentVOconverted to a dict
Cached per (doclist_uri, share_links, expiry) for the lifetime
of this client. Cache is cleared by invalidate_session().
list_documents_in_folder
list_documents_in_folder(workspace_name, folder_path, *, share_links=True)
Walk workspaces → folders → doclist by stable identifiers.
Convenience for the connector: instead of doing the three calls
and the recursive folder-name match manually, hand it the stable
identifiers stored in connection_details and get back the
list of documents in that folder.
Returns None if any step of the walk doesn't find a match
(workspace not accessible, folder renamed/deleted, etc.).
list_folders
list_folders(folders_uri)
Recursive folder tree under a workspace's folders URI.
Folder hierarchy is encoded by XML nesting in Asite's response, so
each entry has a children list with the same shape:
- name / id / id_prefix
- doclist_uri: URI for firstpage_doclist (None for system
folders that don't expose one)
- children: nested folder dicts
- raw: full folderVO element converted to a dict
Cached per folders_uri for the lifetime of this client.
list_workspaces
list_workspaces()
Workspaces accessible to the authenticated user.
Each entry
name: human-readable workspace name (stable identifier)id: session-scopedWorkspace_Idid_prefix: stable numeric prefix of the idfolders_uri: URI to fetch the folder tree for this workspaceraw: fullworkspaceVOelement converted to a dict
Cached for the lifetime of this client. invalidate_session()
clears the cache.
resolve_download_uri
resolve_download_uri(workspace_name, folder_path, file_name)
Return a fresh self-authenticating download URL for the document.
Re-walks workspace → folder → doclist from scratch (caches cleared)
so a stale session is reliably detected by the inherited
_execute_with_reauth machinery and triggers a transparent
re-login before the URL is minted. The returned URL embeds the
current session_id as a query parameter, which Asite's
/downloadDocument/{RevisionId} endpoint accepts as auth
(verified empirically May 2026).
Raises:
| Type | Description |
|---|---|
RuntimeError
|
when the workspace, folder, or file is no
longer reachable. Callers (typically
|
AsiteSessionAuthProvider
Bases: AuthenticationProvider
Kiota authentication provider that injects Asite's ASessionID header.
Wraps an AsiteClient and reads its (lazily-refreshed) session_id
on every outgoing request. To force a re-login after a 401, callers
should call client.invalidate_session() and retry.