canapi package¶
Submodules¶
canapi.auth module¶
canapi.client module¶
-
class
canapi.client.
ClientAPI
(name: str, uri: str, endpoints: dict, root: bool = True, **kwargs)[source]¶ Bases:
object
“A class for building any client api using the information about all of their endpoints.
Parameters: - name (str) – Name of the client api.
- uri (str) – Base uri to use for all endpoints in the api.
- endpoints (dict) – Available subapis and endpoints for the client.
- root (bool) – If this api is the root api.
- kwargs (dict) – Other persistent information to intialize the Session.
-
apis
= {}¶
-
class
canapi.client.
Endpoint
(api: canapi.client.ClientAPI, info: dict)[source]¶ Bases:
object
A class that provides the functionality of accessing and describing an endpoint.
Parameters: - api (ClientAPI) – The client api that this endpoint belongs to.
- info (dict) – Information needed to make a successful request to the endpoint.
canapi.exceptions module¶
Module contents¶
-
canapi.
api
(name: str, version: str = None, use_cache: bool = True, **kwargs) → canapi.client.ClientAPI[source]¶ Gets the client api associated with name.
If cached is set to True then the client api will be fetched from the ClientAPI.apis dictionary. If it is not exist, then the registry will be searched for files with the associated name. When cached is set to False the registry will always be checked and then be set in the cache.
Parameters: - name (str) – Name of the client api.
- version (str) – Specific version of the client api.
- use_cache (bool) – Whether or not to use the ClientAPI cache.
- kwargs (keyword arguments) – Additional keyword arguments to set for the underlying requests.Session.
Returns: The client api associated with name.
Return type: ClientAPI
Raises: ClientAPINotRegistered
– If the client api can not be found in the remote and local registries.
-
canapi.
from_config
(config: dict) → canapi.client.ClientAPI[source]¶ Generates a client api from a config dictionary.
Parameters: config (dict) – The configuration dictionary. Returns: A client api. Return type: ClientAPI