Exceptions

exception yadisk.exceptions.AuthorizationPendingError(error_type=None, msg='', response=None)[source]

Bases: BadRequestError

Thrown when authorization is currently pending, the application has to wait.

exception yadisk.exceptions.BadGatewayError(error_type=None, msg='', response=None)[source]

Bases: RetriableYaDiskError

Thrown when the server returns code 502

exception yadisk.exceptions.BadRequestError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 400.

exception yadisk.exceptions.BadVerificationCodeError(error_type=None, msg='', response=None)[source]

Bases: BadRequestError

Thrown when a verification code has invalid format

exception yadisk.exceptions.ConflictError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 409.

exception yadisk.exceptions.DirectoryExistsError(error_type=None, msg='', response=None)[source]

Bases: PathExistsError

Thrown when the directory already exists.

exception yadisk.exceptions.FieldValidationError(error_type=None, msg='', response=None)[source]

Bases: BadRequestError

Thrown when the request contains fields with invalid data.

exception yadisk.exceptions.ForbiddenError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 403.

exception yadisk.exceptions.GatewayTimeoutError(error_type=None, msg='', response=None)[source]

Bases: RetriableYaDiskError

Thrown when the server returns code 504

exception yadisk.exceptions.InsufficientStorageError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 507.

exception yadisk.exceptions.InternalServerError(error_type=None, msg='', response=None)[source]

Bases: RetriableYaDiskError

Thrown when the server returns code 500.

exception yadisk.exceptions.InvalidClientError(error_type=None, msg='', response=None)[source]

Bases: BadRequestError

Thrown when an invalid client ID or client secret was provided

exception yadisk.exceptions.InvalidGrantError(error_type=None, msg='', response=None)[source]

Bases: BadRequestError

Thrown when a verification code is expired or invalid

exception yadisk.exceptions.InvalidResponseError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when Yandex.Disk did not return a JSON response or if it’s invalid.

exception yadisk.exceptions.LockedError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 423.

exception yadisk.exceptions.MD5DifferError(error_type=None, msg='', response=None)[source]

Bases: ConflictError

Thrown when the MD5 hash of the file to be deleted doesn’t match with the actual one.

exception yadisk.exceptions.NotAcceptableError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 406.

exception yadisk.exceptions.NotFoundError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 404.

exception yadisk.exceptions.OperationNotFoundError(error_type=None, msg='', response=None)[source]

Bases: NotFoundError

Thrown by get_operation_status() when the operation doesn’t exist.

exception yadisk.exceptions.ParentNotFoundError(error_type=None, msg='', response=None)[source]

Bases: ConflictError

Thrown by mkdir, upload, etc. when the parent directory doesn’t exist.

exception yadisk.exceptions.PathExistsError(error_type=None, msg='', response=None)[source]

Bases: ConflictError

Thrown when the requested path already exists.

exception yadisk.exceptions.PathNotFoundError(error_type=None, msg='', response=None)[source]

Bases: NotFoundError

Thrown when the requested path does not exist.

exception yadisk.exceptions.PayloadTooLargeError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 413.

exception yadisk.exceptions.RequestError(msg='')[source]

Bases: YaDiskError

Generic exception class for cases when a request could not be sent or response could not be received.

exception yadisk.exceptions.RequestTimeoutError(msg='')[source]

Bases: RequestError

Thrown when a request timed out.

exception yadisk.exceptions.ResourceIsLockedError(error_type=None, msg='', response=None)[source]

Bases: LockedError

Thrown when the resource is locked by another operation.

exception yadisk.exceptions.RetriableYaDiskError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when there was an error but it would make sense to retry the request.

exception yadisk.exceptions.TooManyRedirectsError(msg='')[source]

Bases: RequestError

Thrown when there were too many redirects.

exception yadisk.exceptions.TooManyRequestsError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 429.

exception yadisk.exceptions.UnauthorizedError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 401.

exception yadisk.exceptions.UnavailableError(error_type=None, msg='', response=None)[source]

Bases: RetriableYaDiskError

Thrown when the server returns code 503.

exception yadisk.exceptions.UnknownYaDiskError(msg='', response=None)[source]

Bases: RetriableYaDiskError

Thrown when the request failed but the response does not contain any error info.

exception yadisk.exceptions.UnsupportedMediaError(error_type=None, msg='', response=None)[source]

Bases: YaDiskError

Thrown when the server returns code 415.

exception yadisk.exceptions.UnsupportedTokenTypeError(error_type=None, msg='', response=None)[source]

Bases: BadRequestError

Thrown when the specified token cannot be used in a request

exception yadisk.exceptions.UploadTrafficLimitExceededError(error_type=None, msg='', response=None)[source]

Bases: LockedError

Thrown when upload limit has been exceeded.

exception yadisk.exceptions.WrongResourceTypeError(msg='')[source]

Bases: YaDiskError

Thrown when the resource was expected to be of different type (e.g., file instead of directory).

exception yadisk.exceptions.YaDiskConnectionError(msg='')[source]

Bases: RequestError

Thrown when a connection error occured.

exception yadisk.exceptions.YaDiskError(error_type=None, msg='', response=None)[source]

Bases: Exception

Base class for all exceptions in this library.

Variables:
  • error_typestr, unique error code as returned by API

  • response – an instance of Response

Parameters:
  • error_typestr, unique error code as returned by API

  • msgstr, exception message

  • response – an instance of Response