FolioClient API

Contents

FolioClient API#

FolioClient#

class folioclient.FolioClient(gateway_url: str, tenant_id: str, username: str, password: str, *, ssl_verify: bool | ssl.SSLContext = True, okapi_url: str | None = None, timeout: float | dict | httpx.Timeout | None | _TimeoutUnsetType = _TIMEOUT_UNSET)[source]#

Bases: object

A Python client for FOLIO APIs

FOLIO: The Future of Libraries is Open, is a library services platform that provides a set of APIs for managing library resources and services.

This class provides methods to interact with FOLIO APIs, including authentication, data retrieval, and data manipulation. It also includes methods for handling pagination and constructing query parameters.

Initialization:

FolioClient is designed to be used as a context manager

>>> from folioclient import FolioClient
>>> with FolioClient(
...     "https://folio-snapshot-okapi.dev.folio.org",
...     "diku",
...     "diku_admin",
...     "admin"
... ) as folio_client:
...     users = folio_client.folio_get("/users", "users", query="username=="diku_admin"")
...     print(users)
...
[{'username': 'diku_admin', 'id': '03d9f2b5-8429-50f8-a3af-0df1ce8be1d6', 'active': True, 'patronGroup': '3684a786-6671-4268-8ed0-9db82ebca60b', 'departments': [], 'proxyFor': [], 'personal': {'lastName': 'ADMINISTRATOR', 'firstName': 'DIKU', 'email': 'admin@diku.example.org', 'addresses': []}, 'createdDate': '2025-05-01T02:00:17.887+00:00', 'updatedDate': '2025-05-01T02:00:17.887+00:00', 'metadata': {'createdDate': '2025-05-01T01:56:12.945+00:00', 'updatedDate': '2025-05-01T02:00:17.882+00:00', 'updatedByUserId': '03d9f2b5-8429-50f8-a3af-0df1ce8be1d6'}, 'preferredEmailCommunication': []}]
Parameters:
  • gateway_url (str) – The base URL for the FOLIO API.

  • tenant_id (str) – The tenant ID for the FOLIO instance.

  • username (str) – The username for authentication.

  • password (str) – The password for authentication.

  • ssl_verify (bool | ssl.SSLContext) – Whether to verify SSL certificates, or a custom SSL context. Default is True.

  • okapi_url (keyword-only, str, optional) – Deprecated. Use gateway_url instead.

  • timeout (float | dict | httpx.Timeout | None, optional) – Timeout configuration for HTTP requests.

__init__(gateway_url: str, tenant_id: str, username: str, password: str, *, ssl_verify: bool | ssl.SSLContext = True, okapi_url: str | None = None, timeout: float | dict | httpx.Timeout | None | _TimeoutUnsetType = _TIMEOUT_UNSET)[source]#
__repr__() str[source]#

Return string representation of the FolioClient instance.

Returns:

String representation showing tenant, URL, and username info.

Return type:

str

Note

For ECS environments, the central tenant ID is also shown, as well as the active tenant ID

__enter__()[source]#

Context manager entry for FolioClient.

Returns:

The FolioClient instance.

Return type:

FolioClient

Note

Instantiates httpx.Client instance for FOLIO using self.get_folio_http_client() and performs initial ECS check.

__exit__(exc_type, exc_value, traceback)[source]#

Context manager exit method.

Parameters:
  • exc_type – Exception type if an exception occurred.

  • exc_value – Exception value if an exception occurred.

  • traceback – Traceback if an exception occurred.

Note

This method logs out of FOLIO for the current session, invalidates any existing startup parameters, and marks the FolioClient instance as closed.

async __aenter__()[source]#

Asynchronous context manager entry for FolioClient.

Returns:

The FolioClient instance.

Return type:

FolioClient

Note

Instantiates httpx.Client and httpx.AsyncClient instance for FOLIO using self.get_folio_http_client() and self.get_folio_http_client_async(), and performs initial ECS check.

async __aexit__(exc_type, exc_value, traceback) None[source]#

Asynchronous context manager exit method.

Parameters:
  • exc_type – Exception type if an exception occurred.

  • exc_value – Exception value if an exception occurred.

  • traceback – Traceback if an exception occurred.

property okapi_url: str#

Convenience property for backwards-compatibility with pre-Sunflower FOLIO systems.

Note

This property is deprecated. Use gateway_url instead.

Returns:

The gateway URL.

Return type:

str

close() None[source]#

Manually close the FolioClient object.

This should only be used when running FolioClient outside a context manager.

async async_close() None[source]#

Manually close the FolioClient object asynchronously.

This should only be used when running FolioClient outside a context manager.

property tenant_id: str#

The active tenant ID.

property username: str#

The username used for authentication.

This is a convenience property that returns the username from the FolioConnectionParameters.

property password: str#

The password used for authentication.

This is a convenience property that returns the password from the FolioConnectionParameters.

property initial_tenant_id: str#

The initial tenant ID used for authentication.

This is a convenience property that returns the initial tenant ID from the FolioConnectionParameters.

property gateway_url: str#

The gateway URL used for authentication.

This is a convenience property that returns the gateway URL from the FolioConnectionParameters.

property ssl_verify: bool | ssl.SSLContext#

Whether SSL verification is enabled

This is a convenience property that returns the ssl_verify value from the FolioConnectionParameters.

property http_timeout: Timeout | None#

The HTTP timeout configuration.

Warning

DEPRECATED: This property will be removed in a future release. The return value is an httpx.Timeout object which may not be compatible with other HTTP libraries.

BREAKING CHANGE: This property now returns an httpx.Timeout object instead of the original timeout parameter value. This may break backwards compatibility if you were using this property with other HTTP libraries.

Returns the httpx.Timeout object configured during initialization, or None for no timeout.

Returns:

Configured timeout object for HTTP requests,

or None for no timeout.

Return type:

httpx.Timeout | None

current_user[source]#

Returns the current user ID for the logged-in user.

First tries the bl-users endpoint, then falls back to the users endpoint.

Returns:

The user ID of the current user, or empty string if unable to fetch.

Return type:

str

Note

For ECS environments, the initial tenant_id used for authentication is used.

identifier_types[source]#

Returns a list of identifier types.

Returns:

List of identifier type objects.

Return type:

List[Dict[str, Any]]

module_versions[source]#

Returns a list of module versions for the current tenant.

Returns:

List of module version IDs.

Return type:

List[str]

statistical_codes[source]#

Returns a list of statistical codes.

Returns:

List of statistical code objects.

Return type:

List[Dict[str, Any]]

contributor_types[source]#

Returns a list of contributor types.

Returns:

List of contributor type objects.

Return type:

List[Dict[str, Any]]

contrib_name_types[source]#

Returns a list of contributor name types.

Returns:

List of contributor name type objects.

Return type:

List[Dict[str, Any]]

instance_types[source]#

Returns a list of instance types.

Returns:

List of instance type objects.

Return type:

List[Dict[str, Any]]

instance_formats[source]#

Returns a list of instance formats.

Returns:

List of instance format objects.

Return type:

List[Dict[str, Any]]

alt_title_types[source]#

Returns a list of alternative title types.

Returns:

List of alternative title type objects.

Return type:

List[Dict[str, Any]]

locations[source]#

Returns a list of locations.

Returns:

List of location objects.

Return type:

List[Dict[str, Any]]

electronic_access_relationships[source]#

Returns a list of electronic access relationships.

Returns:

List of electronic access relationship objects.

Return type:

List[Dict[str, Any]]

instance_note_types[source]#

Returns a list of instance note types.

Returns:

List of instance note type objects.

Return type:

List[Dict[str, Any]]

class_types[source]#

Returns a list of classification types.

Returns:

List of classification type objects.

Return type:

List[Dict[str, Any]]

organizations[source]#

Returns a list of organizations.

Returns:

List of organization objects.

Return type:

List[Dict[str, Any]]

holding_note_types[source]#

Returns a list of holding note types.

Returns:

List of holding note type objects.

Return type:

List[Dict[str, Any]]

call_number_types[source]#

Returns a list of call number types.

Returns:

List of call number type objects.

Return type:

List[Dict[str, Any]]

holdings_types[source]#

Returns a list of holdings types.

Returns:

List of holdings type objects.

Return type:

List[Dict[str, Any]]

modes_of_issuance[source]#

Returns a list of modes of issuance.

Returns:

List of mode of issuance objects.

Return type:

List[Dict[str, Any]]

authority_source_files[source]#

Cached property for all configured authority source files.

Returns:

List of authority source file objects.

Return type:

List[Dict[str, Any]]

subject_types[source]#

Cached property for all configured subject types.

Returns:

List of subject type objects.

Return type:

List[Dict[str, Any]]

validate_client_open()[source]#
property folio_headers: Dict[str, str]#

Convenience property that returns FOLIO headers with the current valid auth token.

INTENDED FOR EXTERNAL USE ONLY This property is designed for users who want to use their own HTTP libraries (requests, aiohttp, etc.) while leveraging FolioClient’s token management.

FolioClient’s own methods (folio_get, folio_post, etc.) do NOT use this property - they use the FolioAuth authentication flow directly.

All headers except x-okapi-token can be modified by: - Bulk assignment: folio_client.folio_headers = {…} - Key assignment: folio_client.folio_headers[‘key’] = ‘value’ - Update method: folio_client.folio_headers.update({…})

Example

>>> import requests
>>> with FolioClient(...) as client:
...     headers = client.folio_headers
...     response = requests.get(url, headers=headers)
Returns:

The FOLIO headers with special x-okapi-tenant handling.

Return type:

FolioHeadersDict

property okapi_headers: Dict[str, str]#

Property that returns okapi headers with the current valid Okapi token.

Deprecated:

Since v1.0.0: Use folio_headers instead. This property will be removed in a future release.

INTENDED FOR EXTERNAL USE ONLY This property is designed for users who want to use their own HTTP libraries (requests, aiohttp, etc.) while leveraging FolioClient’s token management.

All headers except x-okapi-token can be modified by: - Bulk assignment: folio_client.okapi_headers = {…} - Key assignment: folio_client.okapi_headers[‘key’] = ‘value’ - Update method: folio_client.okapi_headers.update({…})

Example

>>> import requests
>>> with FolioClient(...) as client:
...     headers = client.okapi_headers  # Deprecated - use folio_headers
...     response = requests.get(url, headers=headers)
Returns:

The okapi headers with special x-okapi-tenant handling.

Return type:

FolioHeadersDict

property okapi_token: str#

Property that attempts to return a valid Okapi token, refreshing if needed.

Returns:

The Okapi token.

Return type:

str

property access_token: str#

Property that attempts to return a valid access token, refreshing if needed.

Returns:

The access token.

Return type:

str

property refresh_token: str#

Property that returns the current authentication refresh token.

property cookies: Cookies | None#

Property that returns the httpx cookies object for the current session, and refreshes them if needed. Raises FolioClientClosed if the client is closed.

property ecs_central_tenant_id: str | None#

Property that returns the central tenant ID for an ECS FOLIO system

property is_ecs: bool#

Property that returns True if self.ecs_central_tenant_id is an ECS central tenant.

ecs_consortium[source]#

Property that returns the ECS consortia object for the current tenant.

ecs_members[source]#

Property that returns the list of tenant objects of the ECS consortia.

property access_token_expires: datetime | None#

Property that returns the expiration time of the current access token.

property folio_token_expires: datetime | None#

Property that returns the expiration time of the current access token.

Deprecated:

Since v1.0.0: Use access_token_expires instead. This property will be removed in a future release.

login() None[source]#

Logs into FOLIO to get a new FOLIO access token (synchronous).

This method should not be necessary to call directly, as FolioClient automatically handles token refresh as needed, but is provided for backwards-compatibility.

Raises:

FolioClientClosed – If the client has been closed.

async async_login() None[source]#

Logs into FOLIO to get a new FOLIO access token (asynchronous).

This method should not be necessary to call directly, as FolioClient automatically handles token refresh as needed, but is provided as a convenience.

Raises:

FolioClientClosed – If the client has been closed.

logout() None[source]#

Alias for close method.

Raises:

FolioClientClosed – If the client has already been closed.

async async_logout() None[source]#

Alias for async_close method.

Raises:

FolioClientClosed – If the client has already been closed.

build_url(path: str) str[source]#

Build complete URL from gateway URL and path.

Parameters:

path (str) – The API endpoint path to append to the gateway URL.

Returns:

The complete URL with leading/trailing slashes normalized.

Return type:

str

static handle_json_response(response) Any[source]#

Handle JSON response with proper error handling.

Uses orjson for faster parsing if available, otherwise falls back to the standard json library.

Parameters:

response – The HTTP response object to parse.

Returns:

The parsed JSON data, or None if parsing fails.

Return type:

Any

extract_response_data(response, key: str | None) Any[source]#

Extract data from response, optionally using a key.

Parameters:
  • response – The HTTP response object to extract data from.

  • key (str | None) – Optional key to extract specific data from the response. If None, returns the entire JSON response.

Returns:

The extracted data, either the full response or the value at the key.

Return type:

Any

static should_continue_pagination(results: List[Dict], limit: int) bool[source]#

Determine if pagination should continue based on result count.

Parameters:
  • results (List[Dict]) – The current results from the API call.

  • limit (int) – The maximum number of results per page.

Returns:

True if pagination should continue, False otherwise.

Return type:

bool

static get_last_id(results: List[Dict[str, Any]]) str | None[source]#

Extract last ID from results for ID-based pagination.

Parameters:

results (List[Dict[str, Any]]) – List of results containing ID fields.

Returns:

The ID of the last result, or None if results is empty.

Return type:

str | None

static construct_id_offset_query(base_query: str, offset: str) str[source]#

Construct query with ID offset for pagination.

Parameters:
  • base_query (str) – The base CQL query string.

  • offset (str) – The ID to use as an offset for pagination.

Returns:

The constructed query with ID offset condition.

Return type:

str

static prepare_id_offset_query(query: str | None, cql_all: str) str[source]#

Prepare and validate query for ID offset pagination.

Parameters:
  • query (str | None) – The CQL query string to validate.

  • cql_all (str) – Default query to use if no query provided.

Returns:

Validated query string suitable for ID offset pagination.

Return type:

str

Raises:

ValueError – If query is provided but not sorted by ID.

static handle_delete_response(response, path: str) Any[source]#

Handle delete response with proper error handling and logging.

Parameters:
  • response – The HTTP response object from the delete request.

  • path (str) – The API path that was accessed for logging purposes.

Returns:

The response data if successful, None for 204 status.

Return type:

Any

Raises:

httpx.HTTPStatusError – For HTTP status errors (will be converted to FOLIO exceptions by the calling method’s @folio_errors decorator).

folio_get_all(path: str, key: str | None = None, query: str | None = None, limit: int = 100, no_cql: bool = False, **kwargs) Generator[Dict[str, Any], None, None][source]#

Fetches ALL data objects from FOLIO matching query in limit-size chunks.

Provides an iterable object yielding a single record at a time until all records have been returned. Automatically uses id-based offset pagination if the query is sorted by id.

Parameters:
  • path (str) – The API endpoint path.

  • key (str | None) – The key in the JSON response that contains the array of results. Defaults to None.

  • query (str | None) – The query string to filter the data objects. Defaults to None.

  • limit (int) – The maximum number of records to fetch in each chunk. Defaults to 10.

  • no_cql (bool) – Whether to skip CQL query processing. Defaults to False.

  • **kwargs – Additional URL parameters to pass to the endpoint.

Yields:

dict – Individual records from the FOLIO API.

Example

>>> for item in folio_client.folio_get_all(
...     "/item-storage/items", "items", "query", limit=100
... ):
...     process(item)
async folio_get_all_async(path: str, key: str | None = None, query: str | None = None, limit: int = 100, no_cql: bool = False, **kwargs) AsyncGenerator[Dict[str, Any], None][source]#

Asynchronously fetches ALL data objects from FOLIO matching query in limit-size chunks and provides an async iterable object yielding a single record at a time until all records have been returned.

Automatically uses id-based offset pagination if the query is sorted by id.

Parameters:
  • path (str) – The API endpoint path.

  • key (str) – The key in the JSON response that contains the array of results.

  • query (str) – The query string to filter the data objects, default is None.

  • limit (int) – The maximum number of records to fetch in each chunk, default is 10.

  • no_cql (bool) – If True, disables CQL query processing, default is False.

  • **kwargs – Additional URL parameters to pass to path.

Yields:

dict – Individual records from the FOLIO API.

Example

>>> async for item in folio_client.folio_get_all_async(
...     "/path/to/resource", "key", "query", limit=100
... ):
...     process(item)
get_all(path, key=None, query='') Generator[Dict[str, Any], None, None][source]#

Alias for folio_get_all

async get_all_async(path, key=None, query='') AsyncGenerator[Dict[str, Any], None][source]#

Async alias for folio_get_all_async

Note: This method wraps folio_get_all_async() for consistency. For direct access, use folio_get_all_async() instead.

folio_get(path, key=None, query='', query_params: Dict[str, Any] | None = None) Any[source]#

Fetches data from FOLIO and returns it as a JSON object.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • key (str, optional) – Key in JSON response that includes the array of results for query APIs. Defaults to None.

  • query (str, optional) – CQL query string for backwards-compatibility. Defaults to “”.

  • query_params (dict, optional) – Additional query parameters for the specified path. May also be used for query. Defaults to None.

Returns:

Returns value matching key or the JSON object as a dict

Return type:

Any

Raises:
async folio_get_async(path, key=None, query='', query_params: Dict[str, Any] | None = None) Any[source]#

Asynchronously fetches data from FOLIO and returns it as a JSON object.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • key (str, optional) – Key in JSON response that includes the array of results for query APIs. Defaults to None.

  • query (str, optional) – CQL query string for backwards-compatibility. Defaults to “”.

  • query_params (dict, optional) – Additional query parameters for the specified path. May also be used for query. Defaults to None.

Returns:

Returns value matching key or the JSON object as a dict

Return type:

Any

folio_put(path, payload, query_params: Dict[str, Any] | None = None) Dict[str, Any] | None[source]#

Convenience method to update data in FOLIO.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • payload (dict or str) – The data to update as JSON dict or JSON string.

  • query_params (dict, optional) – Additional query parameters. Defaults to None.

Returns:

The JSON response from FOLIO. None: If the response is empty.

Return type:

dict

Raises:
async folio_put_async(path, payload, query_params: Dict[str, Any] | None = None) Dict[str, Any] | None[source]#

Asynchronous convenience method to update data in FOLIO.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • payload (dict or str) – The data to update as JSON dict or JSON string.

  • query_params (dict, optional) – Additional query parameters. Defaults to None.

Returns:

The JSON response from FOLIO. None: If the response is empty.

Return type:

dict

folio_post(path, payload, query_params: Dict[str, Any] | None = None) Dict[str, Any] | None[source]#

Convenience method to post data to FOLIO.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • payload (dict or str) – The data to post as JSON dict or JSON string.

  • query_params (dict, optional) – Additional query parameters. Defaults to None.

Returns:

The JSON response from FOLIO. None: If the response is empty.

Return type:

dict

Raises:
async folio_post_async(path, payload, query_params: Dict[str, Any] | None = None) Dict[str, Any] | None[source]#

Asynchronous convenience method to post data to FOLIO.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • payload (dict or str) – The data to post as JSON dict or JSON string.

  • query_params (dict, optional) – Additional query parameters. Defaults to None.

Returns:

The JSON response from FOLIO. None: If the response is empty.

Return type:

dict

folio_delete(path, query_params: Dict[str, Any] | None = None) Dict[str, Any] | None[source]#

Convenience method to delete data in FOLIO.

Parameters:
  • path (str) – FOLIO API endpoint path.

  • query_params (dict, optional) – Additional query parameters. Defaults to None.

Returns:

The response from FOLIO. None: If the response is empty.

Return type:

dict

Raises:
async folio_delete_async(path, query_params: Dict[str, Any] | None = None) Dict[str, Any] | None[source]#

Asynchronous convenience method to delete data in FOLIO

Parameters:
  • path (str) – FOLIO API endpoint path.

  • query_params (dict, optional) – Additional query parameters. Defaults to None.

Returns:

The response from FOLIO. None: If the response is empty.

Return type:

dict

Raises:
get_folio_http_client() Client[source]#

Returns a httpx client for use in FOLIO communication.

Creates a synchronous HTTP client configured with the appropriate authentication, base URL, timeout, and SSL verification settings.

Returns:

Configured HTTP client for FOLIO API calls.

Return type:

httpx.Client

get_folio_http_client_async() AsyncClient[source]#

Returns an async httpx client for use in FOLIO communication.

Creates an asynchronous HTTP client configured with the appropriate authentication, base URL, timeout, and SSL verification settings.

Returns:

Configured async HTTP client for FOLIO API calls.

Return type:

httpx.AsyncClient

folio_get_single_object(path) Dict[str, Any] | None[source]#

Fetches data from FOLIO and returns it as a JSON object as-is.

This is a convenience method that calls folio_get without specifying a key.

Parameters:

path (str) – FOLIO API endpoint path.

Returns:

The complete JSON response from FOLIO.

Return type:

dict

async folio_get_single_object_async(path) Dict[str, Any] | None[source]#

Asynchronously fetches data from FOLIO and turns it into a json object as is

get_instance_json_schema() Dict[str, Any][source]#

Fetches the JSON Schema for instances

get_holdings_schema() Dict[str, Any][source]#

Fetches the JSON Schema for holdings

get_item_schema() Dict[str, Any][source]#

Fetches the JSON Schema for items

static get_github_request_headers() Dict[str, str][source]#

Returns headers for GitHub API requests, including optional token.

If a GITHUB_TOKEN environment variable is set, it will be used for authenticated requests to increase rate limits.

Returns:

Headers for GitHub API requests.

Return type:

dict

Note

  • Ensure the GITHUB_TOKEN has appropriate permissions for the repositories being accessed.

  • Using a token helps avoid hitting GitHub’s unauthenticated rate limits, which are lower.

static get_latest_from_github(owner, repo, filepath: str, ssl_verify=True) Dict[str, Any][source]#

Fetches the latest version of a FOLIO record schema from a GitHub repository.

Parameters:
  • owner (str) – The GitHub username or organization that owns the repository.

  • repo (str) – The name of the GitHub repository.

  • filepath (str) – The path to the file within the repository.

  • ssl_verify (bool) – Whether to verify SSL certificates. Defaults to True.

Returns:

The latest dereferenced version of the schema from the GitHub repository.

Return type:

dict

Raises:
  • httpx.HTTPStatusError – For HTTP errors from GitHub API.

  • httpx.RequestError – For network connectivity issues.

get_from_github(owner, repo, filepath: str, ssl_verify=True) Dict[str, Any][source]#

Fetches a FOLIO record schema from a GitHub repository.

Parameters:
  • owner (str) – The GitHub username or organization that owns the repository.

  • repo (str) – The name of the GitHub repository.

  • filepath (str) – The path to the file within the repository.

  • ssl_verify (bool) – Whether to verify SSL certificates. Defaults to True.

Returns:

The dereferenced version of the schema from the GitHub repository.

Return type:

dict

Raises:
  • httpx.HTTPStatusError – For HTTP errors from GitHub API.

  • httpx.RequestError – For network connectivity issues.

static fetch_github_schema(schema_url) Dict[str, Any][source]#

Fixes relative $ref references in the schema that refer to submodules, like raml-util.This method can be used as a loader in jsonref.replace_refs.

Params

schema_url: The URL of the schema to fix.

Returns

The fixed schema.

Raises:
  • httpx.HTTPStatusError – For HTTP errors from GitHub API.

  • httpx.RequestError – For network connectivity issues.

get_module_version(module_name: str) str | None[source]#
get_user_schema() Dict[str, Any][source]#

Fetches the JSON Schema for users

get_location_id(location_code) str | None[source]#

Returns the location ID based on a location code

get_metadata_construct() Dict[str, str][source]#

creates a metadata construct with the current API user_id attached

get_loan_policy_id(item_type_id, loan_type_id, patron_group_id, location_id) str[source]#

Retrieves a loan policy from FOLIO, or uses a cached one

get_all_ids(path, query='')[source]#
put_user(user) Dict[str, Any] | None[source]#

Updates a FOLIO user record

Helpers#

class folioclient.FolioClient.FolioHeadersDict(folio_client: FolioClient, *args, **kwargs)[source]#

Bases: dict

Custom dict wrapper for folio_headers that intercepts x-okapi-tenant assignments

__init__(folio_client: FolioClient, *args, **kwargs)[source]#

Initialize the FolioHeadersDict with a reference to the FolioClient.

Parameters:
  • folio_client (FolioClient) – The FolioClient instance this dict belongs to.

  • *args – Arguments to pass to the parent dict constructor.

  • **kwargs – Keyword arguments to pass to the parent dict constructor.

__setitem__(key: str, value: str) None[source]#

Set header value with special handling for x-okapi-tenant.

Parameters:
  • key (str) – The header name.

  • value (str) – The header value.

Note

Setting x-okapi-tenant via headers is deprecated. Use folio_client.tenant_id instead.

update(*args, **kwargs) None[source]#

Override update to handle x-okapi-tenant specially.

Note

Setting x-okapi-tenant via headers is deprecated. Use folio_client.tenant_id instead.

__dict__ = mappingproxy({'__module__': 'folioclient.FolioClient', '__firstlineno__': 112, '__doc__': 'Custom dict wrapper for folio_headers that intercepts x-okapi-tenant assignments', '__init__': <function FolioHeadersDict.__init__>, '__setitem__': <function FolioHeadersDict.__setitem__>, 'update': <function FolioHeadersDict.update>, '__static_attributes__': ('_folio_client',), '__dict__': <attribute '__dict__' of 'FolioHeadersDict' objects>, '__weakref__': <attribute '__weakref__' of 'FolioHeadersDict' objects>, '__annotations__': {}})#
__firstlineno__ = 112#
__module__ = 'folioclient.FolioClient'#
__static_attributes__ = ('_folio_client',)#
folioclient.FolioClient.validate_uuid(my_uuid: str) bool[source]

Validates that a string is a valid UUID