Skip to main content

Alist API 简单封装.

Project description

Alist Sdk

Alist SDK - Test

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。

  1. alist-cli:命令行工具,可以快速的操作Alist。
  2. 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


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.37.15.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

alist_sdk-0.37.15-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file alist_sdk-0.37.15.tar.gz.

File metadata

  • Download URL: alist_sdk-0.37.15.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for alist_sdk-0.37.15.tar.gz
Algorithm Hash digest
SHA256 7116babde6161faee0d9148545aa50d0dd3c7e380d712eca19186a48d312e988
MD5 628f880328430a683c500dc1664cda30
BLAKE2b-256 0d10fd70eacc0d5c3de97cfc78ef9578d9820410ab1bcda00194dfc1b4fabee1

See more details on using hashes here.

File details

Details for the file alist_sdk-0.37.15-py3-none-any.whl.

File metadata

  • Download URL: alist_sdk-0.37.15-py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for alist_sdk-0.37.15-py3-none-any.whl
Algorithm Hash digest
SHA256 56946ddf684aae3427ad4776f8703a670c42add8cebd940fb359533c10d7ec8b
MD5 66c668134d245cabce168aec0e005c89
BLAKE2b-256 2ca56645dce72d3890d1f2caaad1899223a47998fdf2105467466cfc676d520c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page