Skip to main content

tflink

PyPI version PyPI - Python Version PyPI - Downloads GitHub GitHub issues

A simple and easy-to-use Python library for uploading files to tmpfile.link and retrieving download links.

📦 View on PyPI | 📖 Documentation | 🐛 Report Issues

Features

  • 🚀 Simple API - Upload files with just 3 lines of code
  • 🔒 Anonymous & Authenticated - Support for both upload modes
  • 📦 Dual Download Links - Standard and URL-encoded formats
  • 🎯 Type Hints - Full type annotations for better IDE experience
  • ✅ Fully Tested - Comprehensive test coverage
  • 🐍 Python 3.8+ - Modern Python support

Quick Start

Installation

pip install tflink

Upload a File

from tflink import TFLinkClient

# Create client and upload
client = TFLinkClient()
result = client.upload('document.pdf')

# Get download link
print(f"Download: {result.download_link}")

That's it! 🎉

Examples

Anonymous Upload

from tflink import TFLinkClient

client = TFLinkClient()
result = client.upload('document.pdf')

print(f"File: {result.file_name}")
print(f"Size: {result.size:,} bytes")
print(f"Link: {result.download_link}")

Authenticated Upload

from tflink import TFLinkClient

client = TFLinkClient(
    user_id='YOUR_USER_ID',
    auth_token='YOUR_AUTH_TOKEN'
)

result = client.upload('document.pdf')
print(f"Download: {result.download_link}")

Error Handling

from tflink import TFLinkClient
from tflink.exceptions import TFLinkError

client = TFLinkClient()

try:
    result = client.upload('document.pdf')
    print(f"Success: {result.download_link}")
except TFLinkError as e:
    print(f"Error: {e}")

tflink provides two download link formats:

  • download_link - Human-readable, perfect for sharing with users
  • download_link_encoded - URL-safe, ideal for API integrations
result = client.upload('file.pdf')

# For users
print(result.download_link)
# https://d.tmpfile.link/public/2025-07-31/uuid/file.pdf

# For APIs
print(result.download_link_encoded)
# https://d.tmpfile.link/public%2F2025-07-31%2Fuuid%2Ffile.pdf

Both links point to the same file. Use download_link for most cases.

Documentation

API Overview

TFLinkClient

TFLinkClient(
    user_id: str | None = None,
    auth_token: str | None = None,
    base_url: str = "https://tmpfile.link",
    timeout: int = 300,
    max_file_size: int = 104857600  # 100MB default
)

Methods:

  • upload(file_path, filename=None) - Upload a file (max 100MB by default)
  • is_authenticated() - Check authentication status

File Size Limit:

  • Default: 100MB (104,857,600 bytes)
  • Files exceeding the limit are rejected before upload
  • Saves time and bandwidth

UploadResult

Attributes:

  • file_name - Uploaded file name
  • download_link - Standard download URL
  • download_link_encoded - URL-encoded download URL
  • size - File size in bytes
  • file_type - MIME type
  • uploaded_to - Upload destination

Exceptions

  • TFLinkError - Base exception
  • FileNotFoundError - File not found
  • UploadError - Upload failed
  • AuthenticationError - Invalid credentials
  • NetworkError - Network request failed

Development

Install Development Dependencies

pip install -e ".[dev]"

Run Tests

make test           # Run tests
make test-cov       # Run with coverage
make quick-test     # Quick functionality test

Code Quality

make format         # Format code with black
make lint           # Run linters (flake8, mypy)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Changelog

See CHANGELOG.md for version history and changes.

License

MIT License - see LICENSE file for details.

Support


Made with ❤️ for the tmpfile.link community

Metadata

Release files for tflink 0.2.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 0.2.1
File Size Uploaded Provenance Actions
tflink-0.2.1.tar.gz 10.0 kB Without provenance Details for tflink-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 18.7 kB

Security for tflink 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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