Python SDK for Cloudreve sites
Project description
Cloudreve SDK
本项目为 Cloudreve 社区版的 Python SDK。
- 开源地址:https://github.com/yxzlwz/cloudreve-sdk
- PyPI:https://pypi.org/project/cloudreve/
- API文档:https://cloudreve.apifox.cn/
安装
pip3 install cloudreve
使用前说明
- 本项目上传功能目前只适配了本机存储和OneDrive存储,有别的需求可以提PR。
- 鉴于Cloudreve V3的诸多问题和已知V4不开源的消息,本人有意向重新维护一个多用户开源网盘项目,目前正在规划中,有意者欢迎通过页面底部联系方式与我交流!
示例
- 每个方法都写了详细注释,可以直接阅读源码了解
- 除少数特殊说明的接口外,几乎所有对文件的操作都需要使用由字母和数字组成的文件ID作为参数
from cloudreve import Cloudreve
# 初始化
conn = Cloudreve('http://127.0.0.1:5212')
# 登录
conn.login('admin@cloudreve.org', '123456')
# 获取文件ID
file_id = conn.get_id('/hello.py')
# 获取文件属性
data = conn.get_property(file_id)
print(data)
# 获取临时下载URL
url = conn.get_download_url(file_id, 'hello_world.py', True)
# 下载文件到本地
conn.download(file_id, 'hello_world.py')
# 创建目录
conn.create_dir('/python')
# 复制文件
conn.copy('/hello.py', '/python')
# 重命名文件
conn.rename(file_id, 'world.py')
# 移动文件
conn.move('/world.py', '/python')
# 上传文件
conn.upload('/my_file_backup.py', 'D:/my_file.py')
# 获取文件直链(永久有效)
# 直接返回直链
source_link_str = conn.get_source_url(file_id)
# 返回直链和文件名组成的字典
source_link_dict = conn.get_source_url(file_id, url_only=False)
# 同时获取多个文件,由于Cloudreve API实现问题,此时url_only参数必须为False,返回无序列表
list_of_source_link_dicts = conn.get_source_url([file_id], url_only=False)
# 获取分享链接
# 普通分享文件
share_link_str1 = conn.get_share_url(file_id)
# 禁止预览,下载次数限制为10次,过期时间为一天,密码为123456
share_link_str2 = conn.get_share_url(file_id, preview=False, downloads=10, expire=86400, password='123456')
# 分享文件夹
share_link_str3 = conn.get_share_url('IdOfDir', is_dir=True)
联系我们
- Email:yxzlwz@gmail.com
- TG 群:https://t.me/+XW2ok10N8DExMDU1
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
cloudreve-1.0.6.tar.gz
(19.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cloudreve-1.0.6-py3-none-any.whl
(19.0 kB
view details)
File details
Details for the file cloudreve-1.0.6.tar.gz.
File metadata
- Download URL: cloudreve-1.0.6.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c124d9d0ee81cca2c5ddb8498acfdb85489d04aa16091d5ccbd372a03a676ef
|
|
| MD5 |
638b9474329637328f543f545a48250b
|
|
| BLAKE2b-256 |
9dc8d71cf0486bcaa20450f2474eb6446b46204ad7f70d5dcc2b94ccbecdc398
|
File details
Details for the file cloudreve-1.0.6-py3-none-any.whl.
File metadata
- Download URL: cloudreve-1.0.6-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17b615153329ae6a17b8de3e9d991e69f722f8e78e92474a9d1eb42c66e0c82e
|
|
| MD5 |
0de326ec7777c2cda01aa9eeecbeb19e
|
|
| BLAKE2b-256 |
a27820fa177704e99f8c3b92834b79face6db34da404f6c0583e723e14facbc5
|