tfLink API
一个轻量、异步、类型安全的 tfLink Python SDK。
提供临时的文件上传功能(单文件最大 100MB,匿名上传 7 天后自动删除)。
安装
pip install tflink-api
快速开始
import asyncio
from tflink_api import TFLinkClient
async def main():
async with TFLinkClient() as client:
result = await client.upload("document.pdf")
print("下载链接:", result.download_link)
print("文件名:", result.file_name)
print("文件大小:", result.size)
asyncio.run(main())
已认证上传
from tflink_api import TFLinkClient
client = TFLinkClient(
user_id="YOUR_USER_ID",
auth_token="YOUR_AUTH_TOKEN",
)
result = await client.upload("document.pdf")
主要功能
- ✅ 完全异步(基于
httpx) - ✅ 类型提示支持
- ✅ 自动管理 HTTP 会话(上下文管理器)
- ✅ 支持匿名与已认证上传
- ✅ 可直接传入文件路径、文件对象或字节串
- ✅ 可传入自定义 HTTP 客户端
配置
可以通过环境变量(.env 文件或系统环境)配置:
TFLINK_BASE_URL=https://tmpfile.link
TFLINK_API_PATH=api/upload
提示
如果您要上传比较大的文件,需要手动设置 timeout 参数:
await client.upload(f, timeout=1000)
许可证
Metadata
Release files for tflink-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 | |
|---|---|---|---|
| tflink_api-0.0.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tflink_api-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.0 kB
Release files / tflink_api-0.0.1.tar.gz
| Download URL | tflink_api-0.0.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85c7143060087e2c786adda043bf9ce095561152b41251e29b9c8b20ed0e7177
|
|
BLAKE2b-256 checksum How to use checksums |
68025eeb7b556141c97294c47512f3589cda71705fb1435bd973e638f653a66c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / tflink_api-0.0.1-py3-none-any.whl
| Download URL | tflink_api-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20107945262576ab85d20963c417ec49f6b7e09b8bc2641c2c2ef44d02fd0797
|
|
BLAKE2b-256 checksum How to use checksums |
4b0731e30418d1cb5aeed9791c6d6d799f8cf6215a4148d2045ba4022956aad0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|