qci_client.auth

QCi auth application v1.

qci_client.auth.client

Client for QCi’s auth API.

class qci_client.auth.client.AuthClient(*, url: str | None = None, api_token: str | None = None, timeout: float | None = None)[source]

Bases: object

Used to authenticate to QCi applications.

Handles authentication against QCi cloud APIs.

Parameters:
  • url – url basepath to API endpoint, including scheme, if None, then falls back to QCI_API_URL environment variable

  • api_token – refresh token for authenticating to API, if None, then falls back to QCI_TOKEN environment variable

  • timeout – number of seconds before timing out requests, None waits indefinitely

property url: str

Return API URL.

property api_token: str

Return API token.

property timeout: float | None

Return timeout setting.

property access_tokens_url: str

URL used for obtaining access tokens.

property access_token_info: AccessTokensPostResponseBody

Return user’s access token info, retrieving anew when absent or expired.

property access_token: str

Return user’s access token, refreshing if expired or near expiration.

property expires_at_rfc3339: str

Return expiration of user’s access token.

property token_type: str

Return type of user’s access token.

property organization_id: str

Return user’s organization ID.

property user_id: str

Return user’s user ID.

property headers_without_authorization: dict

HTTP headers without bearer token in Authorization header, but with Content-Type, Connection, and optional X-Request-Timeout-Nano headers.

property headers: dict

HTTP headers with bearer token in Authorization header.

property headers_without_connection_close

Headers with cached bearer token, but without connection closing.

get_access_tokens_health() AccessTokensHealthGetResponseBody[source]

GET health.

get_access_tokens_version() AccessTokensVersionGetResponseBody[source]

GET version.

post_access_tokens() AccessTokensPostResponseBody[source]

Authorize user via refresh token used to retrieve finite-lived access_token.