Response Objects

class yadisk.objects.AsyncFilesResourceListObject(files_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: FilesResourceListObject

Flat list of files.

Parameters:
  • files_resource_listdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • itemslist, flat list of files (AsyncResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

class yadisk.objects.AsyncLastUploadedResourceListObject(last_uploaded_resources_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: LastUploadedResourceListObject

List of last uploaded resources.

Parameters:
  • last_uploaded_resources_listdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • itemslist, list of resources (AsyncResourceObject)

  • limitint, maximum number of elements in the list

class yadisk.objects.AsyncOperationLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: OperationLinkObject

Operation link object.

Parameters:
  • linkdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

async get_status(**kwargs) Literal['in-progress', 'success', 'failed'][source]

Get operation status.

Parameters:
  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

OperationNotFoundError – requested operation was not found

Returns:

str, "in-progress" indicates that the operation is currently running, "success" indicates that the operation was successful, "failed" means that the operation failed

async wait(**kwargs) None[source]

Wait until an operation is completed. If the operation fails, an exception is raised. Waiting is performed by calling asyncio.sleep.

Parameters:
  • poll_intervalfloat, interval in seconds between subsequent operation status queries

  • poll_timeoutfloat or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
class yadisk.objects.AsyncPublicResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourceLinkObject, AsyncResourceObjectMethodsMixin

Public resource link object.

Parameters:
  • linkdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

  • public_keystr, public key of the resource

  • public_urlstr, public URL of the resource

class yadisk.objects.AsyncPublicResourceListObject(public_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourceListObject

List of public resources.

Parameters:
  • public_resource_listdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (AsyncResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

  • public_keystr, public key of the resource

class yadisk.objects.AsyncPublicResourceObject(public_resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourceObject, AsyncResourceObjectMethodsMixin

Public resource object.

Parameters:
  • resourcedict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedAsyncPublicResourceObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • view_countint, number of times the public resource was viewed

  • ownerUserPublicInfoObject, owner of the public resource

class yadisk.objects.AsyncPublicResourcesListObject(public_resources_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourcesListObject

List of public resources.

Parameters:
  • public_resources_listdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • itemslist, list of public resources (AsyncPublicResourceObject)

  • typestr, resource type to filter by

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

class yadisk.objects.AsyncResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceLinkObject, AsyncResourceObjectMethodsMixin

Resource link object.

Parameters:
  • linkdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

  • pathstr, path to the resource

class yadisk.objects.AsyncResourceListObject(resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceListObject

List of resources.

Parameters:
  • resource_listdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (AsyncResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

class yadisk.objects.AsyncResourceObject(resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceObject, AsyncResourceObjectMethodsMixin

Resource object.

Parameters:
  • resourcedict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedAsyncResourceListObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • sizesdict[str, str], mapping of all preview sizes, where keys are names and values are download links

class yadisk.objects.AsyncTrashResourceListObject(trash_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: TrashResourceListObject

List of trash resources.

Parameters:
  • trash_resource_listdict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (AsyncTrashResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

class yadisk.objects.AsyncTrashResourceObject(trash_resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: TrashResourceObject

Trash resource object.

Parameters:
  • trash_resourcedict or None

  • yadiskAsyncClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedAsyncTrashResourceListObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • origin_pathstr, original path

  • deleteddatetime.datetime, date of deletion

  • sizesdict[str, str], mapping of all preview sizes, where keys are names and values are download links

async exists(relative_path: str | None = None, /, **kwargs) bool[source]

Check whether the trash resource exists.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

ForbiddenError – application doesn’t have enough rights for this request

Returns:

bool

async get_meta(relative_path: str | None = None, /, **kwargs) AsyncTrashResourceObject[source]

Get meta information about a trash resource.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • limit – number of children resources to be included in the response

  • offset – number of children resources to be skipped in the response

  • preview_size – size of the file preview

  • preview_cropbool, cut the preview to the size specified in the preview_size

  • sortstr, field to be used as a key to sort children resources

  • fields – list of keys to be included in the response

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

AsyncTrashResourceObject

async get_type(relative_path: str | None = None, /, **kwargs) str[source]

Get trash resource type.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

“file” or “dir”

async is_dir(relative_path: str | None = None, /, **kwargs) bool[source]

Check whether resource is a trash directory.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

ForbiddenError – application doesn’t have enough rights for this request

Returns:

True if path is a directory, False otherwise (even if it doesn’t exist)

async is_file(relative_path: str | None = None, /, **kwargs) bool[source]

Check whether resource is a trash file.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

ForbiddenError – application doesn’t have enough rights for this request

Returns:

True if path is a file, False otherwise (even if it doesn’t exist)

async listdir(relative_path: str | None = None, /, **kwargs) AsyncGenerator[AsyncTrashResourceObject, None][source]

Get contents of a trash resource.

Parameters:
  • relative_pathstr or None, relative path to the directory in the trash bin

  • max_itemsint or None, maximum number of returned items (None means unlimited)

  • limit – number of children resources to be included in the response

  • offset – number of children resources to be skipped in the response

  • preview_size – size of the file preview

  • preview_cropbool, cut the preview to the size specified in the preview_size

  • fields – list of keys to be included in the response

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

generator of AsyncTrashResourceObject

async remove(relative_path: str | None = None, /, **kwargs) AsyncOperationLinkObject | None[source]

Remove a trash resource.

Parameters:
  • relative_pathstr or None, relative path to the trash resource to be deleted

  • force_async – forces the operation to be executed asynchronously

  • fields – list of keys to be included in the response

  • waitbool, if True, the method will wait until the asynchronous operation is completed

  • poll_intervalfloat, interval in seconds between subsequent operation status queries

  • poll_timeoutfloat or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

AsyncOperationLinkObject if the operation is performed asynchronously, None otherwise

async restore(dst_path: str, /, **kwargs) AsyncResourceLinkObject | 'AsyncOperationLinkObject'[source]
async restore(relative_path: str | None, dst_path: str, /, **kwargs) AsyncResourceLinkObject | 'AsyncOperationLinkObject'

Restore a trash resource. Returns a link to the newly created resource or a link to the asynchronous operation.

This method takes 1 or 2 positional arguments:

  1. restore(dst_path, /, **kwargs)

  2. restore(relative_path=None, dst_path, /, **kwargs)

Parameters:
  • relative_pathstr or None, relative path to the trash resource to be restored

  • dst_path – destination path

  • overwritebool, determines whether the destination can be overwritten

  • force_async – forces the operation to be executed asynchronously

  • fields – list of keys to be included in the response

  • waitbool, if True, the method will wait until the asynchronous operation is completed

  • poll_intervalfloat, interval in seconds between subsequent operation status queries

  • poll_timeoutfloat or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • aiohttp_argsdict, additional parameters for AIOHTTPSession

  • httpx_argsdict, additional parameters for AsyncHTTPXSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

AsyncResourceLinkObject or AsyncOperationLinkObject

class yadisk.objects.AvailableUntilVerboseObject(available_until_verbose: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Verbose information about the expiration date of a shared resource.

Variables:
  • enabledbool, whether the expiration date is enabled

  • valueint, timestamp of the expiration date

class yadisk.objects.CommentIDsObject(comment_ids: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Comment IDs object.

Parameters:
Variables:
  • private_resourcestr, comment ID for private resources

  • public_resourcestr, comment ID for public resources

class yadisk.objects.DeviceCodeObject(device_code_object: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Result of Client.get_device_code() / AsyncClient.get_device_code().

Parameters:
  • device_code_objectdict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • device_codestr, device code that can be used for obtaining the token

  • user_codestr, code that the user should enter on the OAuth page

  • verification_urlstr, URL of the OAuth page where user is expected to enter the user_code

  • intervalint, the minimum interval (in seconds) with which the app must request an OAuth token. If requests come more often, Yandex OAuth may respond with an error

  • expires_inint, amount of time before the codes expire

class yadisk.objects.DiskInfoObject(disk_info: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Disk information object.

Parameters:
  • disk_infodict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • deletion_restriction_daysint, number of days before file deletion after account lock

  • free_photounlim_end_dateint, timestamp in ms of expiration date of unlimited photo upload

  • hide_screenshots_in_photoslicebool, tells whether the screenshots are hidden in photoslice

  • is_idm_managed_folder_address_accessbool, not clear what this is for

  • is_idm_managed_public_accessbool, not clear what this is for

  • is_legal_entitybool, tells if the account belongs to a legal entity

  • is_paidbool, tells if the account is paid or not

  • max_file_sizeint, maximum supported file size (bytes)

  • paid_max_file_sizeint, maximum supported file size for a paid account (bytes)

  • payment_flowbool, tells if the user is involved in payment_flow

  • photounlim_sizeint, total file size in unlimited photos

  • reg_timedatetime.datetime, Disk registration date

  • revisionint, current revision of Yandex.Disk

  • system_foldersSystemFoldersObject, paths to the system folders

  • total_spaceint, total disk size (bytes)

  • trash_sizeint, amount of space used by trash (bytes), part of used_space

  • unlimited_autoupload_enabledbool, tells whether unlimited autoupload from mobile devices is enabled

  • used_spaceint, amount of space used (bytes)

  • userUserObject, owner of the disk

  • will_be_overdrawnbool, tells if the user will be in overdraft upon reaching free_photounlim_end_date

class yadisk.objects.EXIFObject(exif: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

EXIF metadata object.

Parameters:
Variables:
  • date_timedatetime.datetime, capture date

  • gps_longitudefloat, longitude of the photo’s location

  • gps_latitudefloat, latitude of the photo’s location

class yadisk.objects.ErrorObject(error=None, yadisk=None)[source]

Bases: YaDiskObject

Mirrors Yandex.Disk REST API error object.

Parameters:
  • errordict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • messagestr, human-readable error message

  • descriptionstr, technical error description

  • errorstr, error code

class yadisk.objects.ExternalOrganizationIdVerboseObject(external_organization_id_verbose: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Verbose information about the external organization ID of a shared resource.

Variables:
  • enabledbool, whether the external organization ID is enabled

  • valuestr, external organization ID

class yadisk.objects.FilesResourceListObject(files_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Flat list of files.

Parameters:
  • files_resource_listdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • itemslist, flat list of files (ResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

class yadisk.objects.LastUploadedResourceListObject(last_uploaded_resources_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

List of last uploaded resources.

Parameters:
  • last_uploaded_resources_listdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • itemslist, list of resources (ResourceObject)

  • limitint, maximum number of elements in the list

class yadisk.objects.LinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Link object.

Parameters:
Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

class yadisk.objects.OperationLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: LinkObject

Operation link object.

Parameters:
Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

class yadisk.objects.OperationStatusObject(operation_status: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Operation status object.

Parameters:
  • operation_statusdict or None

  • yadiskYaDisk or None, YaDisk object

Variables:

statusstr, status of the operation

class yadisk.objects.PasswordVerboseObject(password_verbose: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Verbose information about the password of shared resource.

Variables:
  • enabledbool, whether the password is enabled

  • valuestr, password value

class yadisk.objects.PublicAccessObject(public_access: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Access settings of a shared resource.

Variables:
  • macrosList[Union[Literal[“employees”], Literal[“all”]]],, specifies who has access to the shared resource, must contain only one element

  • typestr, specifies the type of access, must be one of the following:

  • macro: access for all employees or all users

  • user: access for a specific user

  • group: access for a specific group

  • department: access for a specific department

Variables:
  • org_idint, organization ID

  • idstr, user, group or department ID

  • rightsList[str], specifies the access rights

Valid access rights:

  • write: write access

  • read: read access

  • read_without_download: read access without download

  • read_with_password: read access with password

  • read_with_password_without_download: read access with password and without download

class yadisk.objects.PublicAvailableSettingsObject(public_available_settings: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Public settings of a shared resource for the current OAuth token owner.

Variables:
  • permissionsList[str], list of available permissions

  • address_access_sharing

    str, specifies who has access to the shared resource, must be one of the following:

    • all: access for all users

    • inner: access for all employees

  • use_sharingbool, whether the resource can be shared

  • macro_sharing

    str, specifies who has access to the shared resource, must be one of the following:

    • all: access for all users

    • inner: access for all employees

  • defaultList[PublicDefault], default public settings

class yadisk.objects.PublicDefaultObject(public_default: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Access settings of a shared resource.

Variables:
  • macrosList[Union[Literal[“employees”], Literal[“all”]]],, specifies who has access to the shared resource, must contain only one element

  • org_idint, organization ID

  • rightsList[str], specifies the access rights

Valid access rights:

  • write: write access

  • read: read access

  • read_without_download: read access without download

  • read_with_password: read access with password

  • read_with_password_without_download: read access with password and without download

class yadisk.objects.PublicResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: LinkObject

Public resource link object.

Parameters:
Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

  • public_keystr, public key of the resource

  • public_urlstr, public URL of the resource

class yadisk.objects.PublicResourceListObject(public_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceListObject

List of public resources.

Parameters:
  • public_resource_listdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (ResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

  • public_keystr, public key of the resource

class yadisk.objects.PublicResourceObject(public_resource=None, yadisk=None)[source]

Bases: ResourceObject

Public resource object.

Parameters:
Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedPublicResourceObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • view_countint, number of times the public resource was viewed

  • ownerUserPublicInfoObject, owner of the public resource

class yadisk.objects.PublicResourcesListObject(public_resources_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

List of public resources.

Parameters:
  • public_resources_listdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • itemslist, list of public resources (PublicResourceObject)

  • typestr, resource type to filter by

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

class yadisk.objects.PublicSettingsObject(public_settings: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Public settings of a shared resource.

Variables:
  • available_untilint, timestamp indicating the expiration date of the link

  • read_onlybool, whether the resource is read-only

  • available_until_verboseAvailableUntilVerboseObject, verbose information about the expiration date

  • passwordstr, password to access the resource

  • password_verbosePasswordVerboseObject, verbose information about the password

  • external_organization_idstr, external organization ID

  • external_organization_id_verboseExternalOrganizationIdVerboseObject, verbose information about the external organization ID

  • accessesList[PublicSettingsAccessObject], list of access settings

class yadisk.objects.ResourceDownloadLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: LinkObject

Resource download link.

Parameters:
Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

class yadisk.objects.ResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: LinkObject

Resource link object.

Parameters:
Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

  • pathstr, path to the resource

class yadisk.objects.ResourceListObject(resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

List of resources.

Parameters:
  • resource_listdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (ResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

class yadisk.objects.ResourceObject(resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Resource object.

Parameters:
Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedResourceListObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • sizesdict[str, str], mapping of all preview sizes, where keys are names and values are download links

class yadisk.objects.ResourceUploadLinkObject(resource_upload_link: dict | None = None, yadisk: Any | None = None)[source]

Bases: LinkObject

Resource upload link.

Parameters:
  • resource_upload_linkdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • operation_idstr, ID of the upload operation

  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

class yadisk.objects.ShareInfoObject(share_info: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Shared folder information object.

Parameters:
Variables:
  • is_rootbool, tells whether the folder is root

  • is_ownedbool, tells whether the user is the owner of this directory

  • rightsstr, access rights

class yadisk.objects.SyncFilesResourceListObject(files_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: FilesResourceListObject

Flat list of files.

Parameters:
  • files_resource_listdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • itemslist, flat list of files (SyncResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

class yadisk.objects.SyncLastUploadedResourceListObject(last_uploaded_resources_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: LastUploadedResourceListObject

List of last uploaded resources.

Parameters:
  • last_uploaded_resources_listdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • itemslist, list of resources (SyncResourceObject)

  • limitint, maximum number of elements in the list

class yadisk.objects.SyncOperationLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: OperationLinkObject

Operation link object.

Parameters:
  • linkdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

get_status(**kwargs) Literal['in-progress', 'success', 'failed'][source]

Get operation status.

Parameters:
  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

OperationNotFoundError – requested operation was not found

Returns:

str, "in-progress" indicates that the operation is currently running, "success" indicates that the operation was successful, "failed" means that the operation failed

wait(**kwargs) None[source]

Wait until an operation is completed. If the operation fails, an exception is raised. Waiting is performed by calling time.sleep.

Parameters:
  • poll_intervalfloat, interval in seconds between subsequent operation status queries

  • poll_timeoutfloat or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
class yadisk.objects.SyncPublicResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourceLinkObject, ResourceObjectMethodsMixin

Public resource link object.

Parameters:
  • linkdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

  • public_keystr, public key of the resource

  • public_urlstr, public URL of the resource

class yadisk.objects.SyncPublicResourceListObject(public_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourceListObject

List of public resources.

Parameters:
  • public_resource_listdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (SyncResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

  • public_keystr, public key of the resource

class yadisk.objects.SyncPublicResourceObject(public_resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourceObject, ResourceObjectMethodsMixin

Public resource object.

Parameters:
  • resourcedict or None

  • yadiskClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedSyncPublicResourceObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • view_countint, number of times the public resource was viewed

  • ownerUserPublicInfoObject, owner of the public resource

class yadisk.objects.SyncPublicResourcesListObject(public_resources_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: PublicResourcesListObject

List of public resources.

Parameters:
  • public_resources_listdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • itemslist, list of public resources (SyncPublicResourceObject)

  • typestr, resource type to filter by

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

class yadisk.objects.SyncResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceLinkObject, ResourceObjectMethodsMixin

Resource link object.

Parameters:
  • linkdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • hrefstr, link URL

  • methodstr, HTTP method

  • templatedbool, tells whether the URL is templated

  • pathstr, path to the resource

class yadisk.objects.SyncResourceListObject(resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceListObject

List of resources.

Parameters:
  • resource_listdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (SyncResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

class yadisk.objects.SyncResourceObject(resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceObject, ResourceObjectMethodsMixin

Resource object.

Parameters:
  • resourcedict or None

  • yadiskClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedSyncResourceListObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • sizesdict[str, str], mapping of all preview sizes, where keys are names and values are download links

class yadisk.objects.SyncTrashResourceListObject(trash_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: TrashResourceListObject

List of trash resources.

Parameters:
  • trash_resource_listdict or None

  • yadiskClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (SyncTrashResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

class yadisk.objects.SyncTrashResourceObject(trash_resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: TrashResourceObject

Trash resource object.

Parameters:
  • trash_resourcedict or None

  • yadiskClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedSyncTrashResourceListObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • origin_pathstr, original path

  • deleteddatetime.datetime, date of deletion

  • sizesdict[str, str], mapping of all preview sizes, where keys are names and values are download links

exists(relative_path: str | None = None, /, **kwargs) bool[source]

Check whether the trash resource exists.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

ForbiddenError – application doesn’t have enough rights for this request

Returns:

bool

get_meta(relative_path: str | None = None, /, **kwargs) SyncTrashResourceObject[source]

Get meta information about a trash resource.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • limit – number of children resources to be included in the response

  • offset – number of children resources to be skipped in the response

  • preview_size – size of the file preview

  • preview_cropbool, cut the preview to the size specified in the preview_size

  • sortstr, field to be used as a key to sort children resources

  • fields – list of keys to be included in the response

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

SyncTrashResourceObject

get_type(relative_path: str | None = None, /, **kwargs) str[source]

Get trash resource type.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

“file” or “dir”

is_dir(relative_path: str | None = None, /, **kwargs) bool[source]

Check whether resource is a trash directory.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

ForbiddenError – application doesn’t have enough rights for this request

Returns:

True if path is a directory, False otherwise (even if it doesn’t exist)

is_file(relative_path: str | None = None, /, **kwargs) bool[source]

Check whether resource is a trash file.

Parameters:
  • relative_pathstr or None, relative path to the trash resource

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:

ForbiddenError – application doesn’t have enough rights for this request

Returns:

True if path is a file, False otherwise (even if it doesn’t exist)

listdir(relative_path: str | None = None, /, **kwargs) Generator[SyncTrashResourceObject, None, None][source]

Get contents of a trash resource.

Parameters:
  • relative_pathstr or None, relative path to the directory in the trash bin

  • max_itemsint or None, maximum number of returned items (None means unlimited)

  • limit – number of children resources to be included in the response

  • offset – number of children resources to be skipped in the response

  • preview_size – size of the file preview

  • preview_cropbool, cut the preview to the size specified in the preview_size

  • fields – list of keys to be included in the response

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

generator of SyncTrashResourceObject

remove(relative_path: str | None = None, /, **kwargs) SyncOperationLinkObject | None[source]

Remove a trash resource.

Parameters:
  • relative_pathstr or None, relative path to the trash resource to be deleted

  • force_async – forces the operation to be executed asynchronously

  • fields – list of keys to be included in the response

  • waitbool, if True, the method will wait until the asynchronous operation is completed

  • poll_intervalfloat, interval in seconds between subsequent operation status queries

  • poll_timeoutfloat or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

SyncOperationLinkObject if the operation is performed asynchronously, None otherwise

restore(dst_path: str, /, **kwargs) SyncResourceLinkObject | 'SyncOperationLinkObject'[source]
restore(relative_path: str | None, dst_path: str, /, **kwargs) SyncResourceLinkObject | 'SyncOperationLinkObject'

Restore a trash resource. Returns a link to the newly created resource or a link to the asynchronous operation.

This method takes 1 or 2 positional arguments:

  1. restore(dst_path, /, **kwargs)

  2. restore(relative_path=None, dst_path, /, **kwargs)

Parameters:
  • relative_pathstr or None, relative path to the trash resource to be restored

  • dst_path – destination path

  • overwritebool, determines whether the destination can be overwritten

  • force_async – forces the operation to be executed asynchronously

  • fields – list of keys to be included in the response

  • waitbool, if True, the method will wait until the asynchronous operation is completed

  • poll_intervalfloat, interval in seconds between subsequent operation status queries

  • poll_timeoutfloat or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised

  • timeoutfloat or tuple, request timeout

  • headersdict or None, additional request headers

  • n_retriesint, maximum number of retries

  • retry_interval – delay between retries in seconds

  • retry_ontuple, additional exception classes to retry on

  • requests_argsdict, additional parameters for RequestsSession

  • httpx_argsdict, additional parameters for HTTPXSession

  • curl_optionsdict, additional options for PycURLSession

  • kwargs – any other parameters, accepted by Session.send_request()

Raises:
Returns:

SyncResourceLinkObject or SyncOperationLinkObject

class yadisk.objects.SystemFoldersObject(system_folders: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Object, containing paths to system folders.

Parameters:
  • system_foldersdict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • odnoklassnikistr, path to the Odnoklassniki folder

  • googlestr, path to the Google+ folder

  • instagramstr, path to the Instagram folder

  • vkontaktestr, path to the VKontakte folder

  • attachstr, path to the mail attachments folder

  • mailrustr, path to the My World folder

  • downloadsstr, path to the Downloads folder

  • applicationsstr path to the Applications folder

  • facebookstr, path to the Facebook folder

  • socialstr, path to the social networks folder

  • messengerstr, path to the Messenger Files folder

  • calendarstr, path to the Meeting Materials folder

  • photostreamstr, path to the camera folder

  • screenshotsstr, path to the screenshot folder

  • scansstr, path to the Scans folder

class yadisk.objects.TokenObject(token: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Token object.

Parameters:
  • tokendict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • access_tokenstr, token string

  • refresh_tokenstr, the refresh-token

  • token_typestr, type of the token

  • expires_inint, amount of time before the token expires

  • scopestr, list of rights requested by the application, returned only if the token has a smaller set of rights than requested

class yadisk.objects.TokenRevokeStatusObject(token_revoke_status: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

Result of token revocation request.

Parameters:
  • token_revoke_statusdict or None

  • yadiskYaDisk or None, YaDisk object

Variables:

statusstr, status of the operation

class yadisk.objects.TrashResourceListObject(trash_resource_list: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceListObject

List of trash resources.

Parameters:
  • trash_resource_listdict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • sortstr, sort type

  • itemslist, list of resources (TrashResourceObject)

  • limitint, maximum number of elements in the list

  • offsetint, offset from the beginning of the list

  • pathstr, path to the directory that contains the elements of the list

  • totalint, number of elements in the list

class yadisk.objects.TrashResourceObject(trash_resource: dict | None = None, yadisk: Any | None = None)[source]

Bases: ResourceObject

Trash resource object.

Parameters:
  • trash_resourcedict or None

  • yadiskClient/AsyncClient or None, YaDisk object

Variables:
  • antivirus_statusstr, antivirus check status

  • filestr, download URL

  • sizeint, file size

  • public_keystr, public resource key

  • sha256str, SHA256 hash

  • md5str, MD5 hash

  • embeddedTrashResourceListObject, list of nested resources

  • namestr, filename

  • exifEXIFObject, EXIF metadata

  • resource_idstr, resource ID

  • custom_propertiesdict, custom resource properties

  • public_urlstr, public URL

  • shareShareInfoObject, shared folder information

  • modifieddatetime.datetime, date of last modification

  • createddatetime.datetime, date of creation

  • photoslice_timedatetime.datetime, photo/video creation date

  • mime_typestr, MIME type

  • pathstr, path to the resource

  • previewstr, file preview URL

  • comment_idsCommentIDsObject, comment IDs

  • typestr, type (“file” or “dir”)

  • media_typestr, file type as determined by Yandex.Disk

  • revisionint, Yandex.Disk revision at the time of last modification

  • origin_pathstr, original path

  • deleteddatetime.datetime, date of deletion

  • sizesdict[str, str], mapping of all preview sizes, where keys are names and values are download links

class yadisk.objects.UserObject(user: dict | None = None, yadisk: Any | None = None)[source]

Bases: YaDiskObject

User object.

Parameters:
  • userdict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • reg_timedatetime.datetime, Disk registration date

  • display_namestr, user’s display name

  • uidstr, user’s UID

  • countrystr, user’s country

  • is_childbool, tells whether it’s a child account

  • loginstr, user’s login

class yadisk.objects.UserPublicInfoObject(public_user_info: dict | None = None, yadisk: Any | None = None)[source]

Bases: UserObject

Public user information object. Inherits from UserObject for compatibility.

Parameters:
  • public_user_infodict or None

  • yadiskYaDisk or None, YaDisk object

Variables:
  • loginstr, user’s login

  • display_namestr, user’s display name

  • uidstr, user’s UID

class yadisk.objects.YaDiskObject(field_types: dict | None = None, yadisk: Any | None = None)[source]

Bases: object

Base class for all objects mirroring the ones returned by Yandex.Disk REST API. It must have a fixed number of fields, each field must have a type. It also supports subscripting and access of fields through the . operator.

Parameters:
  • field_typesdict or None

  • yadiskYaDisk or None, YaDisk object

__matmul__(name: str) Any[source]

The @ operator. Same as YaDiskObject.field(). Can be used like this:

# if embedded or embedded.total turn out to be None, we'll get a ValueError
file_count = client.get_meta("/some_folder") @ "embedded" @ "total"
print(f"/some_folder contains {file_count} files")
Parameters:

namestr, name of the field

Raises:

ValueError – value of the given field is None

Returns:

field’s value

field(name: str) Any[source]

Get value of field name, guarantee it’s not None or raise a ValueError.

Parameters:

namestr, name of the field

Raises:

ValueError – value of the given field is None

Returns:

field’s value

import_fields(source_dict: dict | None) None[source]

Set all the fields of the object to the values in source_dict. All the other fields are ignored

Parameters:

source_dictdict or None (nothing will be done in that case)

remove_alias(alias: str) None[source]

Remove an alias.

Parameters:

aliasstr

remove_field(field: str) None[source]

Remove field.

Parameters:

fieldstr

set_alias(alias: str, name: str) None[source]

Set an alias.

Parameters:
  • aliasstr, alias to add

  • namestr, field name

set_field_type(field: str, type: Callable) None[source]

Set field type.

Parameters:
  • fieldstr

  • type – type or factory

set_field_types(field_types: dict) None[source]

Set the field types of the object

Parameters:

field_typesdict, where keys are the field names and values are types (or factories)