Skip to main content

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)

许可证

MIT

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)

Source distribution for tflink-api 0.0.1
File Size Uploaded
tflink_api-0.0.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tflink-api 0.0.1
File Interpreter ABI Platform
tflink_api-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page