Litterbox API
一个轻量、异步、类型安全的 Litterbox Python SDK。
提供临时的文件上传功能。
安装
pip install litterbox-api
快速开始
import asyncio
from litterbox_api import LitterboxClient
async def main():
async with LitterboxClient() as client:
with open("example.jpg", "rb") as f:
url = await client.upload(f)
print("下载链接:", url)
asyncio.run(main())
主要功能
- ✅ 完全异步(基于
httpx) - ✅ 类型提示支持
- ✅ 自动管理 HTTP 会话(上下文管理器)
- ✅ 自定义有效期与文件名长度
- ✅ 可传入自定义 HTTP 客户端
配置
可以通过环境变量(.env 文件或系统环境)配置:
LITTERBOX_BASE_URL=https://litterbox.catbox.moe
LITTERBOX_API_PATH=resources/internals/api.php
提示
如果您要上传比较大的文件,需要手动设置 timeout 参数:
await client.upload(f, timeout=1000)
许可证
Metadata
Release files for litterbox-api 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| litterbox_api-0.0.1.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| litterbox_api-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / litterbox_api-0.0.1.tar.gz
| Download URL | litterbox_api-0.0.1.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c002939a3258e331d303aafc503837e8fd5b6aa2e408be6e71c34240f78ae5b
|
|
BLAKE2b-256 checksum How to use checksums |
b92a9ee4e87b7db61c6428a48ee8dc51d8adb420358dceff7a3b17a99480bdbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / litterbox_api-0.0.1-py3-none-any.whl
| Download URL | litterbox_api-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0022c5ca6971a379b255a37af800c9b64b317abe825bd6ff5d703941911e6eac
|
|
BLAKE2b-256 checksum How to use checksums |
3d8ce1852b6161c30e97240b5233b6f5861563a0507345b72ac57421d6ec2406
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|