Response Objects
- class yadisk.objects.AsyncFilesResourceListObject(files_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
FilesResourceListObjectFlat list of files.
- Parameters:
files_resource_list – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
items – list, flat list of files (
AsyncResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
- class yadisk.objects.AsyncLastUploadedResourceListObject(last_uploaded_resources_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
LastUploadedResourceListObjectList of last uploaded resources.
- Parameters:
last_uploaded_resources_list – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
items – list, list of resources (
AsyncResourceObject)limit – int, maximum number of elements in the list
- class yadisk.objects.AsyncOperationLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
OperationLinkObjectOperation link object.
- Parameters:
link – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
- async get_status(**kwargs) Literal['in-progress', 'success', 'failed'][source]
Get operation status.
- Parameters:
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – 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_interval – float, interval in seconds between subsequent operation status queries
poll_timeout – float or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
OperationNotFoundError – requested operation was not found
AsyncOperationFailedError – requested operation failed
AsyncOperationPollingTimeoutError – requested operation did not complete in specified time (when poll_timeout is not None)
- class yadisk.objects.AsyncPublicResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourceLinkObject,AsyncResourceObjectMethodsMixinPublic resource link object.
- Parameters:
link – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
public_key – str, public key of the resource
public_url – str, public URL of the resource
- class yadisk.objects.AsyncPublicResourceListObject(public_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourceListObjectList of public resources.
- Parameters:
public_resource_list – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
AsyncResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
public_key – str, public key of the resource
- class yadisk.objects.AsyncPublicResourceObject(public_resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourceObject,AsyncResourceObjectMethodsMixinPublic resource object.
- Parameters:
resource – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
AsyncPublicResourceObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
view_count – int, number of times the public resource was viewed
owner –
UserPublicInfoObject, owner of the public resource
- class yadisk.objects.AsyncPublicResourcesListObject(public_resources_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourcesListObjectList of public resources.
- Parameters:
public_resources_list – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
items – list, list of public resources (
AsyncPublicResourceObject)type – str, resource type to filter by
limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
- class yadisk.objects.AsyncResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceLinkObject,AsyncResourceObjectMethodsMixinResource link object.
- Parameters:
link – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
path – str, path to the resource
- class yadisk.objects.AsyncResourceListObject(resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceListObjectList of resources.
- Parameters:
resource_list – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
AsyncResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
- class yadisk.objects.AsyncResourceObject(resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceObject,AsyncResourceObjectMethodsMixinResource object.
- Parameters:
resource – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
AsyncResourceListObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
sizes – dict[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:
TrashResourceListObjectList of trash resources.
- Parameters:
trash_resource_list – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
AsyncTrashResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
- class yadisk.objects.AsyncTrashResourceObject(trash_resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
TrashResourceObjectTrash resource object.
- Parameters:
trash_resource – dict or None
yadisk –
AsyncClientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
AsyncTrashResourceListObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
origin_path – str, original path
deleted –
datetime.datetime, date of deletionsizes – dict[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_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – 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_path – str 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_crop – bool, cut the preview to the size specified in the preview_size
sort – str, field to be used as a key to sort children resources
fields – list of keys to be included in the response
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
- Returns:
- async get_type(relative_path: str | None = None, /, **kwargs) str[source]
Get trash resource type.
- Parameters:
relative_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
- Returns:
“file” or “dir”
- async is_dir(relative_path: str | None = None, /, **kwargs) bool[source]
Check whether resource is a trash directory.
- Parameters:
relative_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – 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_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – 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_path – str or None, relative path to the directory in the trash bin
max_items – int 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_crop – bool, cut the preview to the size specified in the preview_size
fields – list of keys to be included in the response
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
WrongResourceTypeError – resource is not a directory
- Returns:
generator of
AsyncTrashResourceObject
- async remove(relative_path: str | None = None, /, **kwargs) AsyncOperationLinkObject | None[source]
Remove a trash resource.
- Parameters:
relative_path – str 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
wait – bool, if
True, the method will wait until the asynchronous operation is completedpoll_interval – float, interval in seconds between subsequent operation status queries
poll_timeout – float or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
ResourceIsLockedError – resource is locked by another request
OperationNotFoundError – requested operation was not found
AsyncOperationFailedError – requested operation failed
AsyncOperationPollingTimeoutError – requested operation did not complete in specified time (when poll_timeout is not None)
- Returns:
AsyncOperationLinkObjectif 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:
restore(dst_path, /, **kwargs)restore(relative_path=None, dst_path, /, **kwargs)
- Parameters:
relative_path – str or None, relative path to the trash resource to be restored
dst_path – destination path
overwrite – bool, 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
wait – bool, if
True, the method will wait until the asynchronous operation is completedpoll_interval – float, interval in seconds between subsequent operation status queries
poll_timeout – float or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
aiohttp_args – dict, additional parameters for
AIOHTTPSessionhttpx_args – dict, additional parameters for
AsyncHTTPXSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
PathExistsError – destination path already exists
ForbiddenError – application doesn’t have enough rights for this request
ResourceIsLockedError – resource is locked by another request
OperationNotFoundError – requested operation was not found
AsyncOperationFailedError – requested operation failed
AsyncOperationPollingTimeoutError – requested operation did not complete in specified time (when poll_timeout is not None)
- Returns:
- class yadisk.objects.AvailableUntilVerboseObject(available_until_verbose: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectVerbose information about the expiration date of a shared resource.
- Variables:
enabled – bool, whether the expiration date is enabled
value – int, timestamp of the expiration date
- class yadisk.objects.CommentIDsObject(comment_ids: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectComment IDs object.
- Parameters:
comment_ids – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
private_resource – str, comment ID for private resources
public_resource – str, comment ID for public resources
- class yadisk.objects.DeviceCodeObject(device_code_object: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectResult of
Client.get_device_code()/AsyncClient.get_device_code().- Parameters:
device_code_object – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
device_code – str, device code that can be used for obtaining the token
user_code – str, code that the user should enter on the OAuth page
verification_url – str, URL of the OAuth page where user is expected to enter the
user_codeinterval – int, 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_in – int, amount of time before the codes expire
- class yadisk.objects.DiskInfoObject(disk_info: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectDisk information object.
- Parameters:
disk_info – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
deletion_restriction_days – int, number of days before file deletion after account lock
free_photounlim_end_date – int, timestamp in ms of expiration date of unlimited photo upload
hide_screenshots_in_photoslice – bool, tells whether the screenshots are hidden in photoslice
is_idm_managed_folder_address_access – bool, not clear what this is for
is_idm_managed_public_access – bool, not clear what this is for
is_legal_entity – bool, tells if the account belongs to a legal entity
is_paid – bool, tells if the account is paid or not
max_file_size – int, maximum supported file size (bytes)
paid_max_file_size – int, maximum supported file size for a paid account (bytes)
payment_flow – bool, tells if the user is involved in payment_flow
photounlim_size – int, total file size in unlimited photos
reg_time –
datetime.datetime, Disk registration daterevision – int, current revision of Yandex.Disk
system_folders –
SystemFoldersObject, paths to the system folderstotal_space – int, total disk size (bytes)
trash_size – int, amount of space used by trash (bytes), part of used_space
unlimited_autoupload_enabled – bool, tells whether unlimited autoupload from mobile devices is enabled
used_space – int, amount of space used (bytes)
user –
UserObject, owner of the diskwill_be_overdrawn – bool, 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:
YaDiskObjectEXIF metadata object.
- Parameters:
exif – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
date_time –
datetime.datetime, capture dategps_longitude – float, longitude of the photo’s location
gps_latitude – float, latitude of the photo’s location
- class yadisk.objects.ErrorObject(error=None, yadisk=None)[source]
Bases:
YaDiskObjectMirrors Yandex.Disk REST API error object.
- Parameters:
error – dict or None
yadisk – YaDisk or None, YaDisk object
- Variables:
message – str, human-readable error message
description – str, technical error description
error – str, error code
- class yadisk.objects.ExternalOrganizationIdVerboseObject(external_organization_id_verbose: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectVerbose information about the external organization ID of a shared resource.
- Variables:
enabled – bool, whether the external organization ID is enabled
value – str, external organization ID
- class yadisk.objects.FilesResourceListObject(files_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectFlat list of files.
- Parameters:
files_resource_list – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
items – list, flat list of files (
ResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
- class yadisk.objects.LastUploadedResourceListObject(last_uploaded_resources_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectList of last uploaded resources.
- Parameters:
last_uploaded_resources_list – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
items – list, list of resources (
ResourceObject)limit – int, maximum number of elements in the list
- class yadisk.objects.LinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectLink object.
- Parameters:
link – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
- class yadisk.objects.OperationLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
LinkObjectOperation link object.
- Parameters:
link – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
- class yadisk.objects.OperationStatusObject(operation_status: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectOperation status object.
- Parameters:
operation_status – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
status – str, status of the operation
- class yadisk.objects.PasswordVerboseObject(password_verbose: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectVerbose information about the password of shared resource.
- Variables:
enabled – bool, whether the password is enabled
value – str, password value
- class yadisk.objects.PublicAccessObject(public_access: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectAccess settings of a shared resource.
- Variables:
macros – List[Union[Literal[“employees”], Literal[“all”]]],, specifies who has access to the shared resource, must contain only one element
type – str, 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_id – int, organization ID
id – str, user, group or department ID
rights – List[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:
YaDiskObjectPublic settings of a shared resource for the current OAuth token owner.
- Variables:
permissions – List[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_sharing – bool, 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
default – List[PublicDefault], default public settings
- class yadisk.objects.PublicDefaultObject(public_default: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectAccess settings of a shared resource.
- Variables:
macros – List[Union[Literal[“employees”], Literal[“all”]]],, specifies who has access to the shared resource, must contain only one element
org_id – int, organization ID
rights – List[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:
LinkObjectPublic resource link object.
- Parameters:
link – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
public_key – str, public key of the resource
public_url – str, public URL of the resource
- class yadisk.objects.PublicResourceListObject(public_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceListObjectList of public resources.
- Parameters:
public_resource_list – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
ResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
public_key – str, public key of the resource
- class yadisk.objects.PublicResourceObject(public_resource=None, yadisk=None)[source]
Bases:
ResourceObjectPublic resource object.
- Parameters:
resource – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
PublicResourceObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
view_count – int, number of times the public resource was viewed
owner –
UserPublicInfoObject, owner of the public resource
- class yadisk.objects.PublicResourcesListObject(public_resources_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectList of public resources.
- Parameters:
public_resources_list – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
items – list, list of public resources (
PublicResourceObject)type – str, resource type to filter by
limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
- class yadisk.objects.PublicSettingsObject(public_settings: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectPublic settings of a shared resource.
- Variables:
available_until – int, timestamp indicating the expiration date of the link
read_only – bool, whether the resource is read-only
available_until_verbose –
AvailableUntilVerboseObject, verbose information about the expiration datepassword – str, password to access the resource
password_verbose –
PasswordVerboseObject, verbose information about the passwordexternal_organization_id – str, external organization ID
external_organization_id_verbose –
ExternalOrganizationIdVerboseObject, verbose information about the external organization IDaccesses – List[PublicSettingsAccessObject], list of access settings
- class yadisk.objects.ResourceDownloadLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
LinkObjectResource download link.
- Parameters:
link – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
- class yadisk.objects.ResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
LinkObjectResource link object.
- Parameters:
link – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
path – str, path to the resource
- class yadisk.objects.ResourceListObject(resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectList of resources.
- Parameters:
resource_list – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
ResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
- class yadisk.objects.ResourceObject(resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectResource object.
- Parameters:
resource – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
ResourceListObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
sizes – dict[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:
LinkObjectResource upload link.
- Parameters:
resource_upload_link – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
operation_id – str, ID of the upload operation
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
Bases:
YaDiskObjectShared folder information object.
- Parameters:
share_info – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
is_root – bool, tells whether the folder is root
is_owned – bool, tells whether the user is the owner of this directory
rights – str, access rights
- class yadisk.objects.SyncFilesResourceListObject(files_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
FilesResourceListObjectFlat list of files.
- Parameters:
files_resource_list – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
items – list, flat list of files (
SyncResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
- class yadisk.objects.SyncLastUploadedResourceListObject(last_uploaded_resources_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
LastUploadedResourceListObjectList of last uploaded resources.
- Parameters:
last_uploaded_resources_list – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
items – list, list of resources (
SyncResourceObject)limit – int, maximum number of elements in the list
- class yadisk.objects.SyncOperationLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
OperationLinkObjectOperation link object.
- Parameters:
link – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
- get_status(**kwargs) Literal['in-progress', 'success', 'failed'][source]
Get operation status.
- Parameters:
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – 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_interval – float, interval in seconds between subsequent operation status queries
poll_timeout – float or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
OperationNotFoundError – requested operation was not found
AsyncOperationFailedError – requested operation failed
AsyncOperationPollingTimeoutError – requested operation did not complete in specified time (when poll_timeout is not None)
- class yadisk.objects.SyncPublicResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourceLinkObject,ResourceObjectMethodsMixinPublic resource link object.
- Parameters:
link – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
public_key – str, public key of the resource
public_url – str, public URL of the resource
- class yadisk.objects.SyncPublicResourceListObject(public_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourceListObjectList of public resources.
- Parameters:
public_resource_list – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
SyncResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
public_key – str, public key of the resource
- class yadisk.objects.SyncPublicResourceObject(public_resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourceObject,ResourceObjectMethodsMixinPublic resource object.
- Parameters:
resource – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
SyncPublicResourceObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
view_count – int, number of times the public resource was viewed
owner –
UserPublicInfoObject, owner of the public resource
- class yadisk.objects.SyncPublicResourcesListObject(public_resources_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
PublicResourcesListObjectList of public resources.
- Parameters:
public_resources_list – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
items – list, list of public resources (
SyncPublicResourceObject)type – str, resource type to filter by
limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
- class yadisk.objects.SyncResourceLinkObject(link: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceLinkObject,ResourceObjectMethodsMixinResource link object.
- Parameters:
link – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
href – str, link URL
method – str, HTTP method
templated – bool, tells whether the URL is templated
path – str, path to the resource
- class yadisk.objects.SyncResourceListObject(resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceListObjectList of resources.
- Parameters:
resource_list – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
SyncResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
- class yadisk.objects.SyncResourceObject(resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceObject,ResourceObjectMethodsMixinResource object.
- Parameters:
resource – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
SyncResourceListObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
sizes – dict[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:
TrashResourceListObjectList of trash resources.
- Parameters:
trash_resource_list – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
SyncTrashResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
- class yadisk.objects.SyncTrashResourceObject(trash_resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
TrashResourceObjectTrash resource object.
- Parameters:
trash_resource – dict or None
yadisk –
Clientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
SyncTrashResourceListObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
origin_path – str, original path
deleted –
datetime.datetime, date of deletionsizes – dict[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_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – 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_path – str 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_crop – bool, cut the preview to the size specified in the preview_size
sort – str, field to be used as a key to sort children resources
fields – list of keys to be included in the response
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
- Returns:
- get_type(relative_path: str | None = None, /, **kwargs) str[source]
Get trash resource type.
- Parameters:
relative_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
- Returns:
“file” or “dir”
- is_dir(relative_path: str | None = None, /, **kwargs) bool[source]
Check whether resource is a trash directory.
- Parameters:
relative_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – 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_path – str or None, relative path to the trash resource
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – 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_path – str or None, relative path to the directory in the trash bin
max_items – int 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_crop – bool, cut the preview to the size specified in the preview_size
fields – list of keys to be included in the response
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
WrongResourceTypeError – resource is not a directory
- Returns:
generator of
SyncTrashResourceObject
- remove(relative_path: str | None = None, /, **kwargs) SyncOperationLinkObject | None[source]
Remove a trash resource.
- Parameters:
relative_path – str 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
wait – bool, if
True, the method will wait until the asynchronous operation is completedpoll_interval – float, interval in seconds between subsequent operation status queries
poll_timeout – float or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
ForbiddenError – application doesn’t have enough rights for this request
ResourceIsLockedError – resource is locked by another request
OperationNotFoundError – requested operation was not found
AsyncOperationFailedError – requested operation failed
AsyncOperationPollingTimeoutError – requested operation did not complete in specified time (when poll_timeout is not None)
- Returns:
SyncOperationLinkObjectif 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:
restore(dst_path, /, **kwargs)restore(relative_path=None, dst_path, /, **kwargs)
- Parameters:
relative_path – str or None, relative path to the trash resource to be restored
dst_path – destination path
overwrite – bool, 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
wait – bool, if
True, the method will wait until the asynchronous operation is completedpoll_interval – float, interval in seconds between subsequent operation status queries
poll_timeout – float or None, total polling timeout (None means no timeout), if this timeout is exceeded, an exception is raised
timeout – float or tuple, request timeout
headers – dict or None, additional request headers
n_retries – int, maximum number of retries
retry_interval – delay between retries in seconds
retry_on – tuple, additional exception classes to retry on
requests_args – dict, additional parameters for
RequestsSessionhttpx_args – dict, additional parameters for
HTTPXSessioncurl_options – dict, additional options for
PycURLSessionkwargs – any other parameters, accepted by
Session.send_request()
- Raises:
PathNotFoundError – resource was not found on Disk
PathExistsError – destination path already exists
ForbiddenError – application doesn’t have enough rights for this request
ResourceIsLockedError – resource is locked by another request
OperationNotFoundError – requested operation was not found
AsyncOperationFailedError – requested operation failed
AsyncOperationPollingTimeoutError – requested operation did not complete in specified time (when poll_timeout is not None)
- Returns:
- class yadisk.objects.SystemFoldersObject(system_folders: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectObject, containing paths to system folders.
- Parameters:
system_folders – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
odnoklassniki – str, path to the Odnoklassniki folder
google – str, path to the Google+ folder
instagram – str, path to the Instagram folder
vkontakte – str, path to the VKontakte folder
attach – str, path to the mail attachments folder
mailru – str, path to the My World folder
downloads – str, path to the Downloads folder
applications – str path to the Applications folder
facebook – str, path to the Facebook folder
social – str, path to the social networks folder
messenger – str, path to the Messenger Files folder
calendar – str, path to the Meeting Materials folder
photostream – str, path to the camera folder
screenshots – str, path to the screenshot folder
scans – str, path to the Scans folder
- class yadisk.objects.TokenObject(token: dict | None = None, yadisk: Any | None = None)[source]
Bases:
YaDiskObjectToken object.
- Parameters:
token – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
access_token – str, token string
refresh_token – str, the refresh-token
token_type – str, type of the token
expires_in – int, amount of time before the token expires
scope – str, 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:
YaDiskObjectResult of token revocation request.
- Parameters:
token_revoke_status – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
status – str, status of the operation
- class yadisk.objects.TrashResourceListObject(trash_resource_list: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceListObjectList of trash resources.
- Parameters:
trash_resource_list – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
sort – str, sort type
items – list, list of resources (
TrashResourceObject)limit – int, maximum number of elements in the list
offset – int, offset from the beginning of the list
path – str, path to the directory that contains the elements of the list
total – int, number of elements in the list
- class yadisk.objects.TrashResourceObject(trash_resource: dict | None = None, yadisk: Any | None = None)[source]
Bases:
ResourceObjectTrash resource object.
- Parameters:
trash_resource – dict or None
yadisk –
Client/AsyncClientor None, YaDisk object
- Variables:
antivirus_status – str, antivirus check status
file – str, download URL
size – int, file size
public_key – str, public resource key
sha256 – str, SHA256 hash
md5 – str, MD5 hash
embedded –
TrashResourceListObject, list of nested resourcesname – str, filename
exif –
EXIFObject, EXIF metadataresource_id – str, resource ID
custom_properties – dict, custom resource properties
public_url – str, public URL
share –
ShareInfoObject, shared folder informationmodified –
datetime.datetime, date of last modificationcreated –
datetime.datetime, date of creationphotoslice_time –
datetime.datetime, photo/video creation datemime_type – str, MIME type
path – str, path to the resource
preview – str, file preview URL
comment_ids –
CommentIDsObject, comment IDstype – str, type (“file” or “dir”)
media_type – str, file type as determined by Yandex.Disk
revision – int, Yandex.Disk revision at the time of last modification
origin_path – str, original path
deleted –
datetime.datetime, date of deletionsizes – dict[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:
YaDiskObjectUser object.
- Parameters:
user – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
reg_time –
datetime.datetime, Disk registration datedisplay_name – str, user’s display name
uid – str, user’s UID
country – str, user’s country
is_child – bool, tells whether it’s a child account
login – str, user’s login
- class yadisk.objects.UserPublicInfoObject(public_user_info: dict | None = None, yadisk: Any | None = None)[source]
Bases:
UserObjectPublic user information object. Inherits from
UserObjectfor compatibility.- Parameters:
public_user_info – dict or None
yadisk –
YaDiskor None, YaDisk object
- Variables:
login – str, user’s login
display_name – str, user’s display name
uid – str, user’s UID
- class yadisk.objects.YaDiskObject(field_types: dict | None = None, yadisk: Any | None = None)[source]
Bases:
objectBase 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_types – dict or None
yadisk –
YaDiskor None, YaDisk object
- __matmul__(name: str) Any[source]
The
@operator. Same asYaDiskObject.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:
name – str, 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
Noneor raise aValueError.- Parameters:
name – str, 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_dict – dict or None (nothing will be done in that case)
- set_alias(alias: str, name: str) None[source]
Set an alias.
- Parameters:
alias – str, alias to add
name – str, field name