yndx_disk.api package#
Submodules#
yndx_disk.api.disk module#
- async yndx_disk.api.disk.get_disk_info(token: str, fields: str = '', timeout: int = 30) Response[source]#
Get information about the disk.
Parameters: - token (str): The authentication token for the server. - fields (str, optional): The fields to be included in the response. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the disk information.
yndx_disk.api.exceptions module#
yndx_disk.api.operations module#
- async yndx_disk.api.operations.get_operation_status(token: str, operation_id: str, fields: str = '', timeout: int = 30) Response[source]#
Get the status of an operation on the server.
Parameters: - token (str): The authentication token for the server. - operation_id (str): The ID of the operation to get the status for. - fields (str, optional): The fields to be included in the response. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the status of the operation.
yndx_disk.api.public_resources module#
- async yndx_disk.api.public_resources.get_info(token: str, public_key: str, fields: str = '', path: str = '', preview_size: str = '', sort: str = '', preview_crop: bool = False, limit: int = 100, offset: int = 0, timeout: int = 30) Response[source]#
Get information about a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - public_key (str): The public key of the file or directory to get information about. - fields (str, optional): The fields to be included in the response. Defaults to “”. - path (str, optional): The path of the file or directory to get information about. Defaults to “”. - preview_size (str, optional): The size of the preview to be included in the response. Defaults to “”. - sort (str, optional): The sorting order of the response. Defaults to “”. - preview_crop (bool, optional): Whether to crop the preview. Defaults to False. - limit (int, optional): The maximum number of items to return in the response. Defaults to 100. - offset (int, optional): The number of items to skip before returning the response. Defaults to 0. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the information about the file or directory.
- async yndx_disk.api.public_resources.get_url(token: str, public_key: str, fields: str = '', path: str = '', timeout: int = 30) Response[source]#
Get the download URL for a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - public_key (str): The public key of the file or directory to get the download URL for. - fields (str, optional): The fields to be included in the response. Defaults to “”. - path (str, optional): The path of the file or directory to get the download URL for. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the download URL for the file or directory.
- async yndx_disk.api.public_resources.save_to_disk(token: str, public_key: str, fields: str = '', name: str = '', path: str = '', save_path: str = '', force_async: bool = False, timeout: int = 30) Response[source]#
Save a file or directory from the disk to your own disk.
Parameters: - token (str): The authentication token for the disk. - public_key (str): The public key of the file or directory to be saved. - fields (str, optional): The fields to be included in the response. Defaults to “”. - name (str, optional): The name of the file or directory to be saved. Defaults to “”. - path (str, optional): The path of the file or directory to be saved. Defaults to “”. - save_path (str, optional): The path where the file or directory should be saved to. Defaults to “”. - force_async (bool, optional): Whether to force asynchronous saving. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the save operation.
yndx_disk.api.resources module#
- async yndx_disk.api.resources.copy(token: str, from_path: str, to_path: str, fields: str = '', force_async: bool = False, overwrite: bool = False, timeout: int = 30) Response[source]#
Copy a file or directory from one location to another on the disk.
Parameters: - token (str): The authentication token for the disk. - from_path (str): The path of the file or directory to be copied. - to_path (str): The path where the file or directory should be copied to. - fields (str, optional): The fields to be included in the response. Defaults to “”. - force_async (bool, optional): Whether to force asynchronous copying. Defaults to False. - overwrite (bool, optional): Whether to overwrite the destination file or directory if it already exists. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the copy operation.
- async yndx_disk.api.resources.delete(token: str, path: str, fields: str = '', md5: str = '', force_async: bool = False, permanently: bool = False, timeout: int = 30) Response[source]#
Delete a file or directory from the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to be deleted. - fields (str, optional): The fields to be included in the response. Defaults to “”. - md5 (str, optional): The MD5 hash of the file to be deleted. Defaults to “”. - force_async (bool, optional): Whether to force asynchronous deletion. Defaults to False. - permanently (bool, optional): Whether to delete the file permanently. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the deletion operation.
- async yndx_disk.api.resources.get_all_files(token: str, fields: str = '', media_type: str = '', preview_size: str = '', sort: str = '', preview_crop: bool = False, limit: int = 100, offset: int = 0, timeout: int = 30) Response[source]#
Get a list of all files and directories on the disk.
Parameters: - token (str): The authentication token for the disk. - fields (str, optional): The fields to be included in the response. Defaults to “”. - media_type (str, optional): The media type of the files to be included in the response. Defaults to “”. - preview_size (str, optional): The size of the preview to be included in the response. Defaults to “”. - sort (str, optional): The sorting order of the response. Defaults to “”. - preview_crop (bool, optional): Whether to crop the preview. Defaults to False. - limit (int, optional): The maximum number of items to return in the response. Defaults to 100. - offset (int, optional): The number of items to skip before returning the response. Defaults to 0. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing a list of all files and directories.
- async yndx_disk.api.resources.get_all_public(token: str, fields: str = '', preview_size: str = '', type_filter: str = '', preview_crop: bool = False, limit: int = 100, offset: int = 0, timeout: int = 30) Response[source]#
Get a list of all public files and directories on the disk.
Parameters: - token (str): The authentication token for the disk. - fields (str, optional): The fields to be included in the response. Defaults to “”. - preview_size (str, optional): The size of the preview to be included in the response. Defaults to “”. - type_filter (str, optional): The type of files to be included in the response. Defaults to “”. - preview_crop (bool, optional): Whether to crop the preview. Defaults to False. - limit (int, optional): The maximum number of items to return in the response. Defaults to 100. - offset (int, optional): The number of items to skip before returning the response. Defaults to 0. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing a list of all public files and directories.
- async yndx_disk.api.resources.get_info(token: str, path: str, fields: str = '', preview_size: str = '', sort: str = '', preview_crop: bool = False, limit: int = 100, offset: int = 0, timeout: int = 30) Response[source]#
Get information about a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to get information about. - fields (str, optional): The fields to be included in the response. Defaults to “”. - preview_size (str, optional): The size of the preview to be included in the response. Defaults to “”. - sort (str, optional): The sorting order of the response. Defaults to “”. - preview_crop (bool, optional): Whether to crop the preview. Defaults to False. - limit (int, optional): The maximum number of items to return in the response. Defaults to 100. - offset (int, optional): The number of items to skip before returning the response. Defaults to 0. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the information about the file or directory.
- async yndx_disk.api.resources.get_last_uploads(token: str, fields: str = '', media_type: str = '', preview_size: str = '', preview_crop: bool = False, limit: int = 100, timeout: int = 30) Response[source]#
Get a list of the last uploaded files and directories on the disk.
Parameters: - token (str): The authentication token for the disk. - fields (str, optional): The fields to be included in the response. Defaults to “”. - media_type (str, optional): The media type of the files to be included in the response. Defaults to “”. - preview_size (str, optional): The size of the preview to be included in the response. Defaults to “”. - preview_crop (bool, optional): Whether to crop the preview. Defaults to False. - limit (int, optional): The maximum number of items to return in the response. Defaults to 100. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing a list of the last uploaded files and directories.
- async yndx_disk.api.resources.get_upload_url(token: str, path: str, fields: str = '', overwrite: bool = False, timeout: int = 30) Response[source]#
Get the upload URL for a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to get the upload URL for. - fields (str, optional): The fields to be included in the response. Defaults to “”. - overwrite (bool, optional): Whether to overwrite the file or directory if it already exists. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the upload URL for the file or directory.
- async yndx_disk.api.resources.get_url(token: str, path: str, fields: str = '', timeout: int = 30) Response[source]#
Get the download URL for a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to get the download URL for. - fields (str, optional): The fields to be included in the response. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the download URL for the file or directory.
- async yndx_disk.api.resources.mkdir(token: str, path: str, fields: str = '', timeout: int = 30) Response[source]#
Create a new directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the new directory to be created. - fields (str, optional): The fields to be included in the response. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the creation operation.
- async yndx_disk.api.resources.move(token: str, from_path: str, to_path: str, fields: str = '', force_async: bool = False, overwrite: bool = False, timeout: int = 30) Response[source]#
Move a file or directory from one location to another on the disk.
Parameters: - token (str): The authentication token for the disk. - from_path (str): The path of the file or directory to be moved. - to_path (str): The path where the file or directory should be moved to. - fields (str, optional): The fields to be included in the response. Defaults to “”. - force_async (bool, optional): Whether to force asynchronous moving. Defaults to False. - overwrite (bool, optional): Whether to overwrite the destination file or directory if it already exists. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the move operation.
- async yndx_disk.api.resources.publish(token: str, path: str, body: dict, fields: str = '', allow_address_access: bool = False, timeout: int = 30) Response[source]#
Publish a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to be published. - body (dict): The information to be published. - fields (str, optional): The fields to be included in the response. Defaults to “”. - allow_address_access (bool, optional): Whether to allow address access. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the publish operation.
- async yndx_disk.api.resources.unpublish(token: str, path: str, fields: str = '', timeout: int = 30) Response[source]#
Unpublish a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to be unpublished. - fields (str, optional): The fields to be included in the response. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the unpublish operation.
- async yndx_disk.api.resources.update_info(token: str, path: str, body: dict, fields: str = '', timeout: int = 30) Response[source]#
Update information about a file or directory on the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path of the file or directory to update. - body (dict): The new information to be updated. - fields (str, optional): The fields to be included in the response. Defaults to “”. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the update operation.
- async yndx_disk.api.resources.upload(token: str, path: str, upload_url: str, fields: str = '', disable_redirects: bool = False, timeout: int = 30) Response[source]#
Upload a file or directory to the disk.
Parameters: - token (str): The authentication token for the disk. - path (str): The path where the file or directory should be uploaded. - upload_url (str): The URL to upload the file or directory to. - fields (str, optional): The fields to be included in the response. Defaults to “”. - disable_redirects (bool, optional): Whether to disable redirects. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the upload operation.
yndx_disk.api.trash_resources module#
- async yndx_disk.api.trash_resources.delete(token: str, fields: str = '', path: str = '', force_async: bool = False, timeout: int = 30) Response[source]#
Empty the trash on the server.
Parameters: - token (str): The authentication token for the server. - fields (str, optional): The fields to be included in the response. Defaults to “”. - path (str, optional): The path of the trash to be emptied. Defaults to “”. - force_async (bool, optional): Whether to force asynchronous emptying. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the emptying operation.
- async yndx_disk.api.trash_resources.get_info(token: str, path: str, fields: str = '', preview_size: str = '', sort: str = '', preview_crop: bool = False, limit: int = 100, offset: int = 0, timeout: int = 30) Response[source]#
Get the content of the trash on the server.
Parameters: - token (str): The authentication token for the server. - path (str): The path of the trash to get the content from. - fields (str, optional): The fields to be included in the response. Defaults to “”. - preview_size (str, optional): The size of the preview to be included in the response. Defaults to “”. - sort (str, optional): The sorting order of the response. Defaults to “”. - preview_crop (bool, optional): Whether to crop the preview. Defaults to False. - limit (int, optional): The maximum number of items to return in the response. Defaults to 100. - offset (int, optional): The number of items to skip before returning the response. Defaults to 0. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server containing the content of the trash.
- async yndx_disk.api.trash_resources.restore(token: str, path: str, fields: str = '', name: str = '', force_async: bool = False, overwrite: bool = False, timeout: int = 30) Response[source]#
Restore a file or directory from the trash on the server.
Parameters: - token (str): The authentication token for the server. - path (str): The path of the file or directory to be restored. - fields (str, optional): The fields to be included in the response. Defaults to “”. - name (str, optional): The name of the file or directory to be restored. Defaults to “”. - force_async (bool, optional): Whether to force asynchronous restoring. Defaults to False. - overwrite (bool, optional): Whether to overwrite the destination file or directory if it already exists. Defaults to False. - timeout (int, optional): The timeout for the request in seconds. Defaults to 30.
Returns: - httpx.Response: The response from the server after the restore operation.