pds.api_client.api_client module

PDS Registry Search API

Registry API enabling advanced search on PDS data and metadata. The API provides end-points to search for bundles, collections and any PDS products with advanced search queries. It also enables to browse the archive hierarchically downward (e.g. collection/s products) or upward (e.g. bundles containing a product).

The version of the OpenAPI document: 1.3.0 Contact: pds-operator@jpl.nasa.gov Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.

class pds.api_client.api_client.ApiClient(configuration=None, header_name=None, header_value=None, cookie=None)[source]

Bases: object

Generic 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.

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

NATIVE_TYPES_MAPPING = {'bool': <class 'bool'>, 'date': <class 'datetime.date'>, 'datetime': <class 'datetime.datetime'>, 'float': <class 'float'>, 'int': <class 'int'>, 'long': <class 'int'>, 'object': <class 'object'>, 'str': <class 'str'>}
PRIMITIVE_TYPES = (<class 'float'>, <class 'bool'>, <class 'bytes'>, <class 'str'>, <class 'int'>)
call_api(method, url, header_params=None, body=None, post_params=None, _request_timeout=None) RESTResponse[source]

Makes the HTTP request (synchronous) :param method: Method to call. :param url: Path to method endpoint. :param header_params: Header parameters to be

placed in the request header.

Parameters:
  • body – Request body.

  • dict (post_params) – Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • _request_timeout – timeout setting for this request.

Returns:

RESTResponse

deserialize(response_text, response_type)[source]

Deserializes response into an object.

Parameters:
  • response – RESTResponse object to be deserialized.

  • response_type – class literal for deserialized object, or string of class name.

Returns:

deserialized object.

files_parameters(files=None)[source]

Builds form parameters.

Parameters:

files – File parameters.

Returns:

Form parameters with files.

classmethod get_default()[source]

Return new instance of ApiClient.

This method returns newly created, based on default constructor, object of ApiClient class or returns a copy of default ApiClient.

Returns:

The ApiClient object.

param_serialize(method, resource_path, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, auth_settings=None, collection_formats=None, _host=None, _request_auth=None) Tuple[source]

Builds the HTTP request params needed by the request. :param method: Method to call. :param resource_path: Path to method endpoint. :param path_params: Path parameters in the url. :param query_params: Query parameters in the url. :param header_params: Header parameters to be

placed in the request header.

Parameters:
  • body – Request body.

  • dict (files) – Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • list (auth_settings) – Auth Settings names for the request.

  • dict – key -> filename, value -> filepath, for multipart/form-data.

  • collection_formats – dict of collection formats for path, query, header, and post parameters.

  • _request_auth – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

Returns:

tuple of form (path, http_method, query_params, header_params, body, post_params, files)

parameters_to_tuples(params, collection_formats)[source]

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

parameters_to_url_query(params, collection_formats)[source]

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:

URL query string (e.g. a=Hello%20World&b=123)

response_deserialize(response_data=None, response_types_map=None) ApiResponse[source]

Deserializes response into an object. :param response_data: RESTResponse object to be deserialized. :param response_types_map: dict of response types. :return: ApiResponse

sanitize_for_serialization(obj)[source]

Builds a JSON POST object.

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.

Parameters:

obj – The data to serialize.

Returns:

The serialized form of data.

select_header_accept(accepts: List[str]) str | None[source]

Returns Accept based on an array of accepts provided.

Parameters:

accepts – List of headers.

Returns:

Accept (e.g. application/json).

select_header_content_type(content_types)[source]

Returns Content-Type based on an array of content_types provided.

Parameters:

content_types – List of content-types.

Returns:

Content-Type (e.g. application/json).

classmethod set_default(default)[source]

Set default instance of ApiClient.

It stores default ApiClient.

Parameters:

default – object of ApiClient.

set_default_header(header_name, header_value)[source]
update_params_for_auth(headers, queries, auth_settings, resource_path, method, body, request_auth=None) None[source]

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 sanitize_for_serialization(). :param request_auth: if set, the provided settings will

override the token in the configuration.

property user_agent

User agent for this API client