YaDisk-async is a Yandex.Disk REST API client library with async/await support.
This library is no longer maintained, use yadisk>=2.0.0 instead, it also supports async API.
Documentation is available at Read the Docs (EN) and Read the Docs (RU).
pip install yadisk-async
or
python setup.py install
import yadisk_async
y = yadisk_async.YaDisk(token="<token>")
# or
# y = yadisk_async.YaDisk("<application-id>", "<application-secret>", "<token>")
# Check if the token is valid
print(await y.check_token())
# Get disk information
print(await y.get_disk_info())
# Print files and directories at "/some/path"
print([i async for i in await y.listdir("/some/path")])
# Upload "file_to_upload.txt" to "/destination.txt"
await y.upload("file_to_upload.txt", "/destination.txt")
# Same thing
async with aiofiles.open("file_to_upload.txt", "rb") as f:
await y.upload(f, "/destination.txt")
# Same thing but with regular files
with open("file_to_upload.txt", "rb") as f:
await y.upload(f, "/destination.txt")
# Download "/some-file-to-download.txt" to "downloaded.txt"
await y.download("/some-file-to-download.txt", "downloaded.txt")
# Same thing
async with aiofiles.open("downloaded.txt", "wb") as f:
await y.download("/some-file-to-download.txt", f)
# Permanently remove "/file-to-remove"
await y.remove("/file-to-remove", permanently=True)
# Create a new directory at "/test-dir"
print(await y.mkdir("/test-dir"))
# Always remember to close all the connections or you'll get a warning
await y.close()
- Release 1.4.5 (2023-12-14)
- Added a deprecation warning on import
- This library is no longer maintained, use yadisk>=2.0.0 instead, it also supports async API.
- Release 1.4.4 (2023-10-15)
upload()
anddownload()
(and related) methods can now upload/download non-seekable file-like objects (e.g.stdin
orstdout
when open in binary mode), see PR #31
- Release 1.4.3 (2023-04-22)
app:/
paths now work correctly (see issue #26)
- Release 1.4.2 (2023-03-20)
- Fixed issue #29: TypeError: 'type' object is not subscriptable
- Fixed a bug affecting Python <3.9: TypeError: Too many parameters for typing.AsyncIterable; actual 2, expected 1
- Release 1.4.1 (2023-02-28)
- Fixed issue #28: calling
download_public()
withpath
keyword argument raisesTypeError
- Fixed
AttributeError
raised when callingResourceLinkObject.public_listdir()
- Fixed issue #28: calling
- Release 1.4.0 (2023-01-30)
- Added convenience methods to
...Object
objects (e.g. seeResourceObject
in docs) - Added type hints
- Improved error checking and response validation
- Added
InvalidResponseError
,PayloadTooLargeError
,UploadTrafficLimitExceededError
- Added a few missing fields to
DiskInfoObject
andSystemFoldersObject
- Added
rename()
,upload_by_link()
anddownload_by_link()
methods - Added
default_args
field forYaDisk
object download()
andupload()
now returnResourceLinkObject
- Returned
LinkObject
instances have been replaced by more specific subclasses TimeoutError
now also triggers a retry- Added support for async files for
download()
andupload()
- Use
aiofiles
to open files by default
- Added convenience methods to
- Release 1.3.6 (2023-01-20)
- Fixed issue #26: ':' character in filenames causes
BadRequestError
. This is due the behavior of Yandex.Disk's REST API itself but is avoided on the library level with this fix.
- Fixed issue #26: ':' character in filenames causes
- Release 1.3.5 (2022-11-10)
- Fixed a bug in
is_file()
andis_dir()
: a typo was causingAttributeError
(PR #6).
- Fixed a bug in
- Release 1.3.4 (2022-08-17)
- Fixed a bug in
check_token()
: could throwForbiddenError
if the application lacks necessary permissions (issue #23).
- Fixed a bug in
- Release 1.3.3 (2021-12-31)
- Fixed an issue where
http://
links were not recognized as operation links (they were assumed to always behttps://
, since all the other requests are always HTTPS). Occasionally, Yandex.Disk can for some reason return anhttp://
link to an asynchronous operation instead ofhttps://
. Both links are now recognized correctly and anhttps://
version will always be used byget_operation_status()
, regardless of which one Yandex.Disk returned.
- Fixed an issue where
- Release 1.3.2 (2021-07-10)
- Fixed
__version__
having the old value
- Fixed
- Release 1.3.1 (2021-07-10)
- Fixed
AttributeError
inSessionWithHeaders
(PR #1) - Fixed trash bin tests
- Fixed
- Release 1.3.0 (2019-07-06)
- Modified the original library (yadisk) to support async/await
- The library was renamed to yadisk-async
The following releases are for yadisk, the original library:
- Release 1.2.14 (2019-03-26)
- Fixed a
TypeError
inget_public_*
functions when passingpath
parameter (see issue #7) - Added
unlimited_autoupload_enabled
attribute forDiskInfoObject
- Fixed a
- Release 1.2.13 (2019-02-23)
- Added
md5
parameter forremove()
- Added
UserPublicInfoObject
- Added
country
attribute forUserObject
- Added
photoslice_time
attribute forResourceObject
,PublicResourceObject
andTrashResourceObject
- Added
- Release 1.2.13 (2019-02-23)
- Added
md5
parameter forremove()
- Added
UserPublicInfoObject
- Added
country
attribute forUserObject
- Added
photoslice_time
attribute forResourceObject
,PublicResourceObject
andTrashResourceObject
- Added
- Release 1.2.12 (2018-10-11)
- Fixed fields parameter not working properly in listdir() (issue #4)
- Release 1.2.11 (2018-06-30)
- Added the missing parameter
sort
forget_meta()
- Added
file
andantivirus_status
attributes forResourceObject
,PublicResourceObject
andTrashResourceObject
- Added
headers
parameter - Fixed a typo in
download()
anddownload_public()
(issue #2) - Removed
*args
parameter everywhere
- Added the missing parameter
- Release 1.2.10 (2018-06-14)
- Fixed
timeout=None
behavior.None
is supposed to mean 'no timeout' but in the older versions it was synonymous with the default timeout.
- Fixed
- Release 1.2.9 (2018-04-28)
- Changed the license to LGPLv3 (see
COPYING
andCOPYING.lesser
) - Other package info updates
- Changed the license to LGPLv3 (see
- Release 1.2.8 (2018-04-17)
- Fixed a couple of typos:
PublicResourceListObject.items
andTrashResourceListObject.items
had wrong types - Substitute field aliases in
fields
parameter when performing API requests (e.g.embedded
->_embedded
)
- Fixed a couple of typos:
- Release 1.2.7 (2018-04-15)
- Fixed a file rewinding bug when uploading/downloading files after a retry
- Release 1.2.6 (2018-04-13)
- Now caching
requests
sessions so that open connections can be reused (which can significantly speed things up sometimes) - Disable
keep-alive
when uploading/downloading files by default
- Now caching
- Release 1.2.5 (2018-03-31)
- Fixed an off-by-one bug in
utils.auto_retry()
(which could sometimes result inAttributeError
) - Retry the whole request for
upload()
,download()
anddownload_public()
- Set
stream=True
fordownload()
anddownload_public()
- Other minor fixes
- Fixed an off-by-one bug in
- Release 1.2.4 (2018-02-19)
- Fixed
TokenObject
havingexprires_in
instead ofexpires_in
(fixed a typo)
- Fixed
- Release 1.2.3 (2018-01-20)
- Fixed a
TypeError
whenWrongResourceTypeError
is raised
- Fixed a
- Release 1.2.2 (2018-01-19)
refresh_token()
no longer requires a valid or empty token.
- Release 1.2.1 (2018-01-14)
- Fixed auto retries not working. Whoops.
- Release 1.2.0 (2018-01-14)
- Fixed passing
n_retries=0
toupload()
,download()
anddownload_public()
upload()
,download()
anddownload_public()
no longer return anything (see the docs)- Added
utils
module (see the docs) - Added
RetriableYaDiskError
,WrongResourceTypeError
,BadGatewayError
andGatewayTimeoutError
listdir()
now raisesWrongResourceTypeError
instead ofNotADirectoryError
- Fixed passing
- Release 1.1.1 (2017-12-29)
- Fixed argument handling in
upload()
,download()
anddownload_public()
. Previously, passingn_retries
andretry_interval
would raise an exception (TypeError
).
- Fixed argument handling in
- Release 1.1.0 (2017-12-27)
- Better exceptions (see the docs)
- Added support for
force_async
parameter - Minor bug fixes
- Release 1.0.8 (2017-11-29)
- Fixed yet another
listdir()
bug
- Fixed yet another
- Release 1.0.7 (2017-11-04)
- Added
install_requires
argument tosetup.py
- Added
- Release 1.0.6 (2017-11-04)
- Return
OperationLinkObject
in some functions
- Return
- Release 1.0.5 (2017-10-29)
- Fixed
setup.py
to exclude tests
- Fixed
- Release 1.0.4 (2017-10-23)
- Fixed bugs in
upload
,download
andlistdir
functions - Set default
listdir
limit
to10000
- Fixed bugs in
- Release 1.0.3 (2017-10-22)
- Added settings
- Release 1.0.2 (2017-10-19)
- Fixed
get_code_url
function (added missing parameters)
- Fixed
- Release 1.0.1 (2017-10-18)
- Fixed a major bug in
GetTokenRequest
(added missing parameter)
- Fixed a major bug in
- Release 1.0.0 (2017-10-18)
- Initial release