openaiapi package¶
- class openaiapi.OpenAI¶
Bases:
ServiceWrapper class around the OpenAI API
- completions(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- edits(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- embeddings(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- file(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- file_content(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- files(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- fine_tune(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- fine_tune_cancel(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- fine_tune_events(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- fine_tunes(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- image_edits(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- image_generations(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- image_variations(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- model(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- models(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- moderations(endpoint: apiron.Endpoint, method: str | None = None, session: requests.Session | None = None, params: dict[str, Any] | None = None, data: dict[str, Any] | None = None, files: dict[str, str] | None = None, json: dict[str, Any] | None = None, headers: dict[str, Any] | None = None, cookies: dict[str, Any] | None = None, auth: Any | None = None, encoding: str | None = None, retry_spec: retry.Retry | None = None, timeout_spec: Timeout | None = None, logger: logging.Logger | None = None, allow_redirects: bool = True, return_raw_response_object: bool | None = None, **kwargs)¶
- Parameters:
service (Service) – The service that hosts the endpoint being called
endpoint (Endpoint) – The endpoint being called
method (str) – The HTTP method to use for the call
session (requests.Session) – (optional) An existing session, useful for making many calls in a single session (default
None)params (dict) – (optional)
GETparameters to send to the endpoint (defaultNone)data (dict) – (optional)
POSTdata to send to the endpoint. Adictwill be form-encoded, while astrwill be sent raw (defaultNone)files (dict) – (optional) Dictionary of
'filename': file-like-objectsfor multipart encoding upload. (defaultNone)json (dict) – (optional) A JSON-serializable dictionary that will be sent as the
POSTbody (defaultNone)headers (dict) – HTTP Headers to send to the endpoint (default
None)cookies (dict) – Cookies to send to the endpoint (default
None)auth – An object suitable for the
requests.Requestobject’sauthargumentencoding (str) – The codec to use when decoding the response. Default behavior is to have
requestsguess the codec. (defaultNone)retry_spec (urllib3.util.retry.Retry) – (optional) An override of the retry behavior for this call. (default
None)timeout_spec (Timeout) – (optional) An override of the timeout behavior for this call. (default
None)logger (logging.Logger) – (optional) An existing logger for logging from the proper caller for better correlation
allow_redirects (bool) – (optional) Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection (default
True)return_raw_response_object (bool) – Whether to return a
requests.Responseobject or callformat_response()on it first. (DefaultFalse)**kwargs – Arguments to be formatted into the
endpointargument’spathattribute
- Returns:
The result of
endpoint’sformat_response()- Return type:
The type returned by
endpoint’sformat_response()- Raises:
requests.RetryError – if retry threshold exceeded due to bad HTTP codes (default 500 range)
requests.ConnectionError – if retry threshold exceeded due to connection or request timeouts
- property required_headers¶
Required headers for API calls; these can be enhanced or overridden on a per-call basis.