aistore.sdk.response_handler

View as Markdown

Module Contents

Classes

NameDescription
AISResponseHandlerHandle responses from an AIS cluster
ResponseHandlerAbstract base class for handling HTTP API responses

API

class aistore.sdk.response_handler.AISResponseHandler()

Bases: ResponseHandler

Handle responses from an AIS cluster

exc_class
Type[AISError]
aistore.sdk.response_handler.AISResponseHandler._parse_404(
is_etl_err: bool,
is_remote_bck: typing.Optional[bool] = None,
provider: typing.Optional[aistore.sdk.provider.Provider] = None,
has_obj: bool = False
) -> typing.Optional[typing.Type[aistore.sdk.errors.AISError]]
staticmethod
aistore.sdk.response_handler.AISResponseHandler._parse_409(
is_etl_err: bool,
is_get_request: bool,
provider: typing.Optional[aistore.sdk.provider.Provider] = None,
has_obj: bool = False
) -> typing.Optional[typing.Type[aistore.sdk.errors.AISError]]
staticmethod
aistore.sdk.response_handler.AISResponseHandler.parse_error(
r: requests.Response
) -> aistore.sdk.errors.AISError

Parse response contents to raise an appropriate AISError object.

Parameters:

r
requests.Response

HTTP status code of an HTTPError returned from AIS

Returns: AISError

If the error doesn’t match any specific conditions.

class aistore.sdk.response_handler.ResponseHandler()
Abstract

Abstract base class for handling HTTP API responses

exc_class
Type[APIRequestError]

Exception class for generic error handling (must be implemented)

aistore.sdk.response_handler.ResponseHandler.handle_response(
r: requests.Response
) -> requests.Response

Method compatible with requests hook signature to process an HTTP response

Parameters:

r
requests.Response

Response from the server

aistore.sdk.response_handler.ResponseHandler.parse_error(
r: requests.Response
) -> aistore.sdk.errors.APIRequestError
abstract

Parse custom exception from failed response (must be implemented)