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()
命令行工具 [开发中]
Alist SDK 提供了2个命令行工具,可以方便的操作Alist。
alist-cli:命令行工具,可以快速的操作Alist。alist-fs:(alist-cli fs的别名)文件相关操作,包括上传、下载、删除、查看文件信息等。
Usage: alist-cli [OPTIONS] COMMAND [ARGS]...
Options:
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help
Commands:
│ admin 管理命令 │
│ auth Authentication commands. │
│ fs 文件系统相关操作
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
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
File details
Details for the file alist_sdk-0.42.20.tar.gz.
File metadata
- Download URL: alist_sdk-0.42.20.tar.gz
- Upload date:
- Size: 41.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dbb79d4731ea49b67c576dc7a81480f94e8051cb3c3c230962cff88f28e9e09
|
|
| MD5 |
2ec6c9e07395a8440dcb28375f13d22b
|
|
| BLAKE2b-256 |
e3983ad4274f697c738c097a0bb56f30355739d9526849cf13a355907c467a57
|
Provenance
The following attestation bundles were made for alist_sdk-0.42.20.tar.gz:
Publisher:
deploy.yaml on lee-cq/alist-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alist_sdk-0.42.20.tar.gz -
Subject digest:
8dbb79d4731ea49b67c576dc7a81480f94e8051cb3c3c230962cff88f28e9e09 - Sigstore transparency entry: 171501911
- Sigstore integration time:
-
Permalink:
lee-cq/alist-sdk@d9d0c840c0c5f24674b6909694b5a960c05a777a -
Branch / Tag:
refs/tags/0.42.20 - Owner: https://github.com/lee-cq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@d9d0c840c0c5f24674b6909694b5a960c05a777a -
Trigger Event:
release
-
Statement type:
File details
Details for the file alist_sdk-0.42.20-py3-none-any.whl.
File metadata
- Download URL: alist_sdk-0.42.20-py3-none-any.whl
- Upload date:
- Size: 44.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6baac86d24c42b39b1823d7b984a30331ddd88f3e457a110ef1c7e7cb727cb2f
|
|
| MD5 |
9bdfdfac4803d533b2181f6f3b48e310
|
|
| BLAKE2b-256 |
8576fa0b476b600c9a7de42c0b11e50265f2a251a1088b99c7c9ea098ce4fba0
|
Provenance
The following attestation bundles were made for alist_sdk-0.42.20-py3-none-any.whl:
Publisher:
deploy.yaml on lee-cq/alist-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alist_sdk-0.42.20-py3-none-any.whl -
Subject digest:
6baac86d24c42b39b1823d7b984a30331ddd88f3e457a110ef1c7e7cb727cb2f - Sigstore transparency entry: 171501917
- Sigstore integration time:
-
Permalink:
lee-cq/alist-sdk@d9d0c840c0c5f24674b6909694b5a960c05a777a -
Branch / Tag:
refs/tags/0.42.20 - Owner: https://github.com/lee-cq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@d9d0c840c0c5f24674b6909694b5a960c05a777a -
Trigger Event:
release
-
Statement type: