authnzerver.apiclient module

This contains an auto-generated API client for the authnzerver.

class authnzerver.apiclient.APIClient(authnzerver_url: str = None, authnzerver_secret: bytes = None, asynchronous: bool = False, use_kwargs: bool = False)[source]

Bases: object

An API client for the authnzerver.

This auto-generates class methods to call for each API action available in the authnzerver API schema.

Parameters:
  • authnzerver_url (str) – The URL of the authnzerver to connect to.
  • authnzerver_secret (str) – The shared secret key for the authnzerver.
  • asynchronous (bool, optional, default=False) – If True, generates awaitable async methods for all API actions.
  • use_kwargs (bool, option, default=False) – If this is True, all arguments for the auto-generated API methods will be keyword arguments instead of regular arguments for required parameters and keyword arguments for optional ones.

Notes

Since the class methods and their docstrings are dynamically generated, a simple help() call won’t work to show docstrings.

If you’re using IPython or the Jupyter notebook, using a ? at the end of the method name works as expected:

# create a new client
srv = APIClient(authnzerver_url=..., authnzerver_secret=...)

# get help on the user_new() method
srv.user_new?

In a normal Python shell, however, you must use the following pattern to get help on an APIClient method:

# create a new client
srv = APIClient(authnzerver_url=..., authnzerver_secret=...)

# get help on the user_new() method
print(srv.user_new.__doc__)
async_dynamic_api_function(api_action: str, use_kwargs: bool, *args, **kwargs)[source]

Validates an API action, then fires the API call.

This version is async.

dynamic_api_function(api_action: str, use_kwargs: bool, *args, **kwargs)[source]

Validates an API action, then fires the API call.

authnzerver.apiclient.dynamic_docstring(action: str, use_kwargs: bool = False) → str[source]

This adds a docstring to the dynamically generated function.