A Python client for tmpfile.link file upload service
Project description
tflink
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}")
Download Links
tflink provides two download link formats:
download_link- Human-readable, perfect for sharing with usersdownload_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
- 📖 Getting Started Guide - Detailed tutorials and examples
- 📚 API Reference - Complete API documentation
- 🛠️ Developer Guide - For contributors and maintainers
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 namedownload_link- Standard download URLdownload_link_encoded- URL-encoded download URLsize- File size in bytesfile_type- MIME typeuploaded_to- Upload destination
Exceptions
TFLinkError- Base exceptionFileNotFoundError- File not foundUploadError- Upload failedAuthenticationError- Invalid credentialsNetworkError- 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Changelog
See CHANGELOG.md for version history and changes.
License
MIT License - see LICENSE file for details.
Links
- PyPI: https://pypi.org/project/tflink/
- GitHub: https://github.com/tflink-tmpfile/tflink
- Documentation: docs/
- tmpfile.link: https://tmpfile.link
- Issues: https://github.com/tflink-tmpfile/tflink/issues
- Email: pypi@tmpfile.link
Support
- 📧 Email: pypi@tmpfile.link
- 🐛 Issues: GitHub Issues
- 📖 Docs: Documentation
Made with ❤️ for the tmpfile.link community
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tflink-0.2.0.tar.gz.
File metadata
- Download URL: tflink-0.2.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e80d42a7ebce6b79c82e692749424eacf4e24ef2a40d1d4a196e49ef1725662
|
|
| MD5 |
7b5cb2b589efa2322e0df4908e4c0d4f
|
|
| BLAKE2b-256 |
59d497fb26dcc3138984b14ef858a814c677a351ead9c35a8039fbc27276a7ea
|
File details
Details for the file tflink-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tflink-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d59f28e15c21b1305bf7ad8abbcb13b013727de2334e41da0a47d0f05fe8841
|
|
| MD5 |
0254d5f8f55edd9641b5587ab64ec2a3
|
|
| BLAKE2b-256 |
9a267e45d56f6bdaa31d11b1f99e2bfe970e1d5d069bbb3eaf6fb8934bf13f1c
|