ApiClient#

class ApiClient(session, api_url, configuration)#

Provides a generic API client for OpenAPI client library builds.

This client handles client-server communication and is invariant across implementations. Specifics of the methods and models for each application are generated from OpenAPI templates and are responsible for interfacing with the public API exposed by the client.

Parameters:
sessionrequests.Session

Base session object that the API client is to use.

api_urlstr

Base URL for the API. All generated endpoint URLs are relative to this address.

configurationSessionConfiguration

Configuration options for the API client.

Examples

>>> client = ApiClient(requests.Session(),
...                    'http://my-api.com/API/v1.svc',
...                    SessionConfiguration())
... <ApiClient url: http://my-api.com/API/v1.svc>

For testing purposes, it is common to configure an API with a self-signed certificate. By default, the ApiClient class will not trust self-signed SSL certificates. To allow this, pass a path to the root certificate to the SessionConfiguration object. For more configuration examples, see SessionConfiguration.

>>> session_config = SessionConfiguration(cert_store_path='./self-signed-cert.pem')
... ssl_client = ApiClient(requests.Session(),
...                    'https://secure-api/API/v1.svc',
...                    session_config)
... ssl_client
<ApiClient url: https://secure-api/API/v1.svc>

Methods

ApiClient.call_api(resource_path, method[, ...])

Make the HTTP request and return the deserialized data.

ApiClient.deserialize(response, response_type)

Deserialize the response into an object.

ApiClient.parameters_to_tuples(params, ...)

Get parameters as a list of tuples, formatting collections.

ApiClient.prepare_post_parameters([...])

Build form parameters.

ApiClient.request(method, url[, ...])

Make the HTTP request and return it directly.

ApiClient.sanitize_for_serialization(obj)

Build a JSON POST object.

ApiClient.select_header_accept(accepts)

Return a correctly formatted Accept header value from the provided array of accepted content types.

ApiClient.select_header_content_type(...)

Return the preferred Content-Type header value from the provided array of valid content types.

ApiClient.setup_client(models)

Set up the client for use and register models for serialization and deserialization.

Attributes