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全部使用的同步方法(与Pathlib API保持一致)。
如果需要异步操作,可以使用asyncio.to_thread
将同步方法转为异步方法。
from alist_sdk.path_lib import login_server, AlistPath
# 登录方式1
login_server("http://localhost:5244", username='admin', password='123456')
path = AlistPath('http://localhost:5244/test')
# 登录方式2 version > 0.36.13
path = AlistPath('http://localhost:5244/test', username='admin', password='123456')
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.36.13a4.tar.gz
(35.6 kB
view hashes)
Built Distribution
Close
Hashes for alist_sdk-0.36.13a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0543cbed9956a8e2cb376ddb4504002dcdd229f84e4576b3281f2bcf035a3bd5 |
|
MD5 | 78fe5f4bfa3bb3e488a8f12620ce19d8 |
|
BLAKE2b-256 | dfa58663832708d7467fefe48aea1c8c87608281638af29c6bbaf8212ce43aca |