Библиотека-клиент REST API Яндекс.Диска / Yandex.Disk REST API client library
Project description
YaDisk - это библиотека-клиент REST API Яндекс.Диска.
Документация доступна на Read the Docs (RU) и Read the Docs (EN).
Установка
pip install yadisk
или
python setup.py install
Примеры
import yadisk
y = yadisk.YaDisk(token="<токен>")
# или
# y = yadisk.YaDisk("<id-приложения>", "<secret-приложения>", "<токен>")
# Проверяет, валиден ли токен
print(y.check_token())
# Получает общую информацию о диске
print(y.get_disk_info())
# Выводит содержимое "/some/path"
print(list(y.listdir("/some/path")))
# Загружает "file_to_upload.txt" в "/destination.txt"
y.upload("file_to_upload.txt", "/destination.txt")
# То же самое
with open("file_to_upload.txt", "rb") as f:
y.upload(f, "/destination.txt")
# Скачивает "/some-file-to-download.txt" в "downloaded.txt"
y.download("/some-file-to-download.txt", "downloaded.txt")
# Безвозвратно удаляет "/file-to-remove"
y.remove("/file-to-remove", permanently=True)
# Создаёт новую папку "/test-dir"
print(y.mkdir("/test-dir"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yadisk-1.2.10.tar.gz
(37.0 kB
view hashes)
Built Distribution
yadisk-1.2.10-py3-none-any.whl
(30.0 kB
view hashes)