Alist API 简单封装.
Project description
Alist Sdk
Alist API 简单封装
Alist API 文档
安装
从PyPI安装最新release版本
pip install alist-sdk
从GitHub安装dev版本
pip install git+https://github.com/lee-cq/alist-sdk.git
使用
客户端或异步客户端方法签名于API基本一致。
# Sync 模式
from alist_sdk import Client
client = Client(
base_url='http://localhost:5244',
username="",
password="",
token="", # 与 Username Password 二选一
)
client.me()
client.mkdir("/local/test")
# Async 模式
import asyncio
from alist_sdk import AsyncClient
client = AsyncClient(
base_url='http://localhost:5244',
username="",
password="",
token="", # 与 Username Password 二选一
)
asyncio.run(client.me())
像使用pathlib一样操作Alist上的文件,但是需要注意的是,AlistPath的方法都是同步的,如果需要异步操作,可以使用asyncio.to_thread
将同步方法转为异步方法。
from alist_sdk.path_lib import login_server, AlistPath
login_server("http://localhost:5244", username='admin', password='123456')
path = AlistPath('http://localhost:5244/test')
path.stat()
path.is_dir()
path.read_text()
path.iterdir()
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
alist-sdk-0.30.9.tar.gz
(31.9 kB
view hashes)
Built Distribution
alist_sdk-0.30.9-py3-none-any.whl
(33.9 kB
view hashes)
Close
Hashes for alist_sdk-0.30.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edd4163eb40abf897b8ababb7373e0aa44bd9aad30c1c5029911c7003a936d6f |
|
MD5 | b24abbc05b631568e6430b119f843bbe |
|
BLAKE2b-256 | 54b0592cdc39445818eb009d645977b53495f1fead43918346439119b37d78c3 |