academic_observatory_api.client¶
Academic Observatory API
The REST API for accessing data from academic-observatory-workflows. # noqa: E501
The version of the OpenAPI document: 1.0.0 Contact: agent@observatory.academy Generated by: https://openapi-generator.tech
Subpackages¶
Submodules¶
Package Contents¶
Classes¶
Generic API client for OpenAPI client library builds. |
|
NOTE: This class is auto generated by OpenAPI Generator |
Attributes¶
- class academic_observatory_api.client.ApiClient(configuration=None, header_name=None, header_value=None, cookie=None, pool_threads=1)[source]¶
Bases:
objectGeneric API client for OpenAPI client library builds.
OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the OpenAPI templates.
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
- Parameters
configuration – .Configuration object for this client
header_name – a header to pass when making calls to the API.
header_value – a header value to pass when making calls to the API.
cookie – a cookie to include in the header when making calls to the API
pool_threads – The number of threads to use for async requests to the API. More threads means more concurrent API requests.
- _pool¶
- __enter__(self)¶
- __exit__(self, exc_type, exc_value, traceback)¶
- close(self)¶
- property pool(self)¶
Create thread pool on first request avoids instantiating unused threadpool for blocking clients.
- property user_agent(self)¶
User agent for this API client
- set_default_header(self, header_name, header_value)¶
- __call_api(self, resource_path: str, method: str, path_params: Optional[Dict[str, Any]] = None, query_params: Optional[List[Tuple[str, Any]]] = None, header_params: Optional[Dict[str, Any]] = None, body: Optional[Any] = None, post_params: Optional[List[Tuple[str, Any]]] = None, files: Optional[Dict[str, List[io.IOBase]]] = None, response_type: Optional[Tuple[Any]] = None, auth_settings: Optional[List[str]] = None, _return_http_data_only: Optional[bool] = None, collection_formats: Optional[Dict[str, str]] = None, _preload_content: bool = True, _request_timeout: Optional[Union[int, float, Tuple]] = None, _host: Optional[str] = None, _check_type: Optional[bool] = None, _content_type: Optional[str] = None, _request_auths: Optional[List[Dict[str, Any]]] = None)¶
- parameters_to_multipart(self, params, collection_types)¶
Get parameters as list of tuples, formatting as json if value is collection_types
- Parameters
params – Parameters as list of two-tuples
collection_types (dict) – Parameter collection types
- Returns
Parameters as list of tuple or urllib3.fields.RequestField
- classmethod sanitize_for_serialization(cls, obj)¶
Prepares data for transmission before it is sent with the rest client If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. If obj is io.IOBase, return the bytes :param obj: The data to serialize. :return: The serialized form of data.
- deserialize(self, response, response_type, _check_type)¶
Deserializes response into an object.
- Parameters
response – RESTResponse object to be deserialized.
response_type – For the response, a tuple containing: valid classes a list containing valid classes (for list schemas) a dict containing a tuple of valid classes as the value Example values: (str,) (Pet,) (float, none_type) ([int, none_type],) ({str: (bool, str, int, float, date, datetime, str, none_type)},)
_check_type (bool) – boolean, whether to check the types of the data received from the server
- Returns
deserialized object.
- call_api(self, resource_path: str, method: str, path_params: Optional[Dict[str, Any]] = None, query_params: Optional[List[Tuple[str, Any]]] = None, header_params: Optional[Dict[str, Any]] = None, body: Optional[Any] = None, post_params: Optional[List[Tuple[str, Any]]] = None, files: Optional[Dict[str, List[io.IOBase]]] = None, response_type: Optional[Tuple[Any]] = None, auth_settings: Optional[List[str]] = None, async_req: Optional[bool] = None, _return_http_data_only: Optional[bool] = None, collection_formats: Optional[Dict[str, str]] = None, _preload_content: bool = True, _request_timeout: Optional[Union[int, float, Tuple]] = None, _host: Optional[str] = None, _check_type: Optional[bool] = None, _request_auths: Optional[List[Dict[str, Any]]] = None)¶
Makes the HTTP request (synchronous) and returns deserialized data.
To make an async_req request, set the async_req parameter.
- Parameters
resource_path – Path to method endpoint.
method – Method to call.
path_params – Path parameters in the url.
query_params – Query parameters in the url.
header_params – Header parameters to be placed in the request header.
body – Request body.
dict (post_params) – Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.
list (auth_settings) – Auth Settings names for the request.
response_type – For the response, a tuple containing: valid classes a list containing valid classes (for list schemas) a dict containing a tuple of valid classes as the value Example values: (str,) (Pet,) (float, none_type) ([int, none_type],) ({str: (bool, str, int, float, date, datetime, str, none_type)},)
files (dict) – key -> field name, value -> a list of open file objects for multipart/form-data.
bool (async_req) – execute request asynchronously
_return_http_data_only (bool, optional) – response data without head status code and headers
collection_formats (dict, optional) – dict of collection formats for path, query, header, and post parameters.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_check_type (bool, optional) – boolean describing if the data back from the server should have its type checked.
_request_auths (list, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- Returns
If async_req parameter is True, the request will be called asynchronously. The method will return the request thread. If parameter async_req is False or missing, then the method will return the response directly.
- request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)¶
Makes the HTTP request using RESTClient.
- parameters_to_tuples(self, params, collection_formats)¶
Get parameters as list of tuples, formatting collections.
- Parameters
params – Parameters as dict or list of two-tuples
collection_formats (dict) – Parameter collection formats
- Returns
Parameters as list of tuples, collections formatted
- static get_file_data_and_close_file(file_instance: io.IOBase) bytes¶
- files_parameters(self, files: Optional[Dict[str, List[io.IOBase]]] = None)¶
Builds form parameters.
- Parameters
files – None or a dict with key=param_name and value is a list of open file objects
- Returns
List of tuples of form parameters with file data
- select_header_accept(self, accepts)¶
Returns Accept based on an array of accepts provided.
- Parameters
accepts – List of headers.
- Returns
Accept (e.g. application/json).
- select_header_content_type(self, content_types, method=None, body=None)¶
Returns Content-Type based on an array of content_types provided.
- Parameters
content_types – List of content-types.
method – http method (e.g. POST, PATCH).
body – http body to send.
- Returns
Content-Type (e.g. application/json).
- update_params_for_auth(self, headers, queries, auth_settings, resource_path, method, body, request_auths=None)¶
Updates header and query params based on authentication setting.
- Parameters
headers – Header parameters dict to be updated.
queries – Query parameters tuple list to be updated.
auth_settings – Authentication setting identifiers list.
resource_path – A string representation of the HTTP request resource path.
method – A string representation of the HTTP request method.
body – A object representing the body of the HTTP request. The object type is the return value of _encoder.default().
request_auths – if set, the provided settings will override the token in the configuration.
- _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting)¶
- class academic_observatory_api.client.Configuration(host=None, api_key=None, api_key_prefix=None, access_token=None, username=None, password=None, discard_unknown_keys=False, disabled_client_side_validations='', server_index=None, server_variables=None, server_operation_index=None, server_operation_variables=None, ssl_ca_cert=certifi.where())[source]¶
Bases:
objectNOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech Do not edit the class manually.
- param host
Base url
- param api_key
Dict to store API key(s). Each entry in the dict specifies an API key. The dict key is the name of the security scheme in the OAS specification. The dict value is the API key secret.
- param api_key_prefix
Dict to store API prefix (e.g. Bearer) The dict key is the name of the security scheme in the OAS specification. The dict value is an API key prefix when generating the auth data.
- param username
Username for HTTP basic authentication
- param password
Password for HTTP basic authentication
- param discard_unknown_keys
Boolean value indicating whether to discard unknown properties. A server may send a response that includes additional properties that are not known by the client in the following scenarios: 1. The OpenAPI document is incomplete, i.e. it does not match the server
implementation.
The client was generated using an older version of the OpenAPI document and the server has been upgraded since then.
If a schema in the OpenAPI document defines the additionalProperties attribute, then all undeclared properties received by the server are injected into the additional properties map. In that case, there are undeclared properties, and nothing to discard.
- param disabled_client_side_validations (string)
Comma-separated list of JSON schema validation keywords to disable JSON schema structural validation rules. The following keywords may be specified: multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, maxItems, minItems. By default, the validation is performed for data generated locally by the client and data received from the server, independent of any validation performed by the server side. If the input data does not satisfy the JSON schema validation rules specified in the OpenAPI document, an exception is raised. If disabled_client_side_validations is set, structural validation is disabled. This can be useful to troubleshoot data validation problem, such as when the OpenAPI document validation rules do not match the actual API data received by the server.
- param server_index
Index to servers configuration.
- param server_variables
Mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before.
- param server_operation_index
Mapping from operation ID to an index to server configuration.
- param server_operation_variables
Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before.
- param ssl_ca_cert
str - the path to a file of concatenated CA certificates in PEM format
- Example
API Key Authentication Example. Given the following security scheme in the OpenAPI specification:
- components:
- securitySchemes:
- cookieAuth: # name for the security scheme
type: apiKey in: cookie name: JSESSIONID # cookie name
You can programmatically set the cookie:
- conf = academic_observatory_api.client.Configuration(
api_key={‘cookieAuth’: ‘abc123’} api_key_prefix={‘cookieAuth’: ‘JSESSIONID’}
)
- The following cookie will be added to the HTTP request:
Cookie: JSESSIONID abc123
- _default¶
- _base_path¶
Default Base url
- server_operation_index¶
Default server index
- server_operation_variables¶
Default server variables
- temp_folder_path¶
Temp file folder for downloading files
- refresh_api_key_hook¶
function hook to refresh API key if expired
- username¶
Username for HTTP basic authentication
- password¶
Password for HTTP basic authentication
- logger¶
Logging Settings
- logger_format = %(asctime)s %(levelname)s %(message)s¶
Log format
- logger_stream_handler¶
Log stream handler
- logger_file_handler¶
Log file handler
- logger_file¶
Debug file location
- debug = False¶
Debug switch
- verify_ssl = True¶
SSL/TLS verification Set this to false to skip verifying SSL certificate when calling API from https server.
- ssl_ca_cert¶
Set this to customize the certificate file to verify the peer.
- cert_file¶
client certificate file
- key_file¶
client key file
- assert_hostname¶
Set this to True/False to enable/disable SSL hostname verification.
- connection_pool_maxsize¶
urllib3 connection pool’s maximum number of connections saved per pool. urllib3 uses 1 connection as default value, but this is not the best value when you are making a lot of possibly parallel requests to the same host, which is often the case here. cpu_count * 5 is used as default value to increase performance.
- proxy¶
Proxy URL
- proxy_headers¶
Proxy headers
- safe_chars_for_path_param =¶
Safe chars for path_param
- retries¶
Adding retries to override urllib3 default value 3
- __deepcopy__(self, memo)¶
- __setattr__(self, name, value)¶
Implement setattr(self, name, value).
- classmethod set_default(cls, default)¶
Set default instance of configuration.
It stores default configuration, which can be returned by get_default_copy method.
- Parameters
default – object of Configuration
- classmethod get_default_copy(cls)¶
Return new instance of configuration.
This method returns newly created, based on default constructor, object of Configuration class or returns a copy of default configuration passed by the set_default method.
- Returns
The configuration object.
- property logger_file(self)¶
The logger file.
If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler.
- Parameters
value – The logger_file path.
- Type
str
- property debug(self)¶
Debug status
- Parameters
value – The debug status, True or False.
- Type
bool
- property logger_format(self)¶
The logger format.
The logger_formatter will be updated when sets logger_format.
- Parameters
value – The format string.
- Type
str
- get_api_key_with_prefix(self, identifier, alias=None)¶
Gets API key (with prefix if set).
- Parameters
identifier – The identifier of apiKey.
alias – The alternative identifier of apiKey.
- Returns
The token for api key authentication.
- get_basic_auth_token(self)¶
Gets HTTP basic authentication header (string).
- Returns
The token for basic HTTP authentication.
- auth_settings(self)¶
Gets Auth Settings dict for api client.
- Returns
The Auth Settings information dict.
- to_debug_report(self)¶
Gets the essential information for debugging.
- Returns
The report for debugging.
- get_host_settings(self)¶
Gets an array of host settings
- Returns
An array of host settings
- get_host_from_settings(self, index, variables=None, servers=None)¶
Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value :param servers: an array of host settings or None :return: URL based on host settings
- property host(self)¶
Return generated host.
- exception academic_observatory_api.client.OpenApiException[source]¶
Bases:
ExceptionThe base exception class for all OpenAPIExceptions
- exception academic_observatory_api.client.ApiAttributeError(msg, path_to_item=None)[source]¶
Bases:
OpenApiException,AttributeErrorThe base exception class for all OpenAPIExceptions
- exception academic_observatory_api.client.ApiTypeError(msg, path_to_item=None, valid_classes=None, key_type=None)[source]¶
Bases:
OpenApiException,TypeErrorThe base exception class for all OpenAPIExceptions
- exception academic_observatory_api.client.ApiValueError(msg, path_to_item=None)[source]¶
Bases:
OpenApiException,ValueErrorThe base exception class for all OpenAPIExceptions
- exception academic_observatory_api.client.ApiKeyError(msg, path_to_item=None)[source]¶
Bases:
OpenApiException,KeyErrorThe base exception class for all OpenAPIExceptions
- exception academic_observatory_api.client.ApiException(status=None, reason=None, http_resp=None)[source]¶
Bases:
OpenApiExceptionThe base exception class for all OpenAPIExceptions
- __str__(self)¶
Custom error messages for exception