| |
- ai_api_client_sdk.helpers.rest_client.RestClient(builtins.object)
-
- InternalRestClient
class InternalRestClient(ai_api_client_sdk.helpers.rest_client.RestClient) |
|
InternalRestClient(base_url=None, get_token=None, resource_group=None, *args, **kwargs)
InternalRestClient is a class implemented for sending requests to services within aicore. The InternalRestClient should only be used for services that do not require authentication when called within aicore. |
|
- Method resolution order:
- InternalRestClient
- ai_api_client_sdk.helpers.rest_client.RestClient
- builtins.object
Methods defined here:
- __init__(self, base_url=None, get_token=None, resource_group=None, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
Methods inherited from ai_api_client_sdk.helpers.rest_client.RestClient:
- delete(self, path: str, params: Dict[str, str] = None, headers: Dict[str, str] = None, resource_group: str = None, **kwargs) -> dict
- Sends a DELETE request to the server.
:param path: path of the endpoint the request should be sent to
:type path: str
:param params: parameters of the request, defaults to None
:type params: Dict[str, str], optional
:param headers: headers of the request, defaults to None
:type headers: Dict[str, str], optional
:param resource_group: Resource Group which the request should be sent on behalf. Either this, or the
resource_group property of this class should be set.
:type resource_group: str
:param kwargs: additional keyword arguments to be passed to the request e.g. files, stream, etc.
:type kwargs: dict
:raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
the server
:raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
server
:return: The JSON response from the server (The keys decamelized)
:rtype: dict
- get(self, path: str, params: Dict[str, str] = None, headers: Dict[str, str] = None, resource_group: str = None, return_bytes_content: bool = False, **kwargs) -> Union[dict, int]
- Sends a GET request to the server.
:param path: path of the endpoint the request should be sent to
:type path: str
:param params: parameters of the request, defaults to None
:type params: Dict[str, str], optional
:param headers: headers of the request, defaults to None
:type headers: Dict[str, str], optional
:param resource_group: Resource Group which the request should be sent on behalf. Either this, or the
resource_group property of this class should be set.
:type resource_group: str
:param return_bytes_content: expected response.content is bytes
:type return_bytes_content: bool
:param kwargs: additional keyword arguments to be passed to the request e.g. files, stream, etc.
:type kwargs: dict
:raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
the server
:raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
server
:return: The JSON response from the server (The keys decamelized)
:rtype: Union[dict, int]
- patch(self, path: str, body: Dict[str, Union[str, dict, list]], headers: Dict[str, str] = None, resource_group: str = None, **kwargs) -> dict
- Sends a PATCH request to the server.
:param path: path of the endpoint the request should be sent to
:type path: str
:param body: body of the request
:type body: Dict[str, Union[str, dict, list]]
:param headers: headers of the request, defaults to None
:type headers: Dict[str, str], optional
:param resource_group: Resource Group which the request should be sent on behalf. Either this, or the
resource_group property of this class should be set.
:type resource_group: str
:param kwargs: additional keyword arguments to be passed to the request e.g. files, stream, etc.
:type kwargs: dict
:raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
the server
:raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
server
:return: The JSON response from the server (The keys decamelized)
:rtype: dict
- post(self, path: str, body: Dict[str, Union[str, dict]] = None, headers: Dict[str, str] = None, resource_group: str = None, **kwargs) -> dict
- Sends a POST request to the server.
:param path: path of the endpoint the request should be sent to
:type path: str
:param body: body of the request, defaults to None
:type body: Dict[str, str], optional
:param headers: headers of the request, defaults to None
:type headers: Dict[str, str], optional
:param resource_group: Resource Group which the request should be sent on behalf. Either this, or the
resource_group property of this class should be set.
:type resource_group: str
:param kwargs: additional keyword arguments to be passed to the request e.g. files, stream, etc.
:type kwargs: dict
:raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
server
:raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
the server
:raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
server
:return: The JSON response from the server (The keys decamelized)
:rtype: dict
Static methods inherited from ai_api_client_sdk.helpers.rest_client.RestClient:
- raise_ai_api_exception(error_description, response, response_json)
Data descriptors inherited from ai_api_client_sdk.helpers.rest_client.RestClient:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from ai_api_client_sdk.helpers.rest_client.RestClient:
- logger = <Logger ai-api-client-sdk (WARNING)>
| |