A simple and easy-to-use Python library for uploading files to tmpfile.link and retrieving download links.
π¦ View on PyPI | π Documentation | π Report Issues
- π 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
pip install tflinkfrom 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! π
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}")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}")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 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.pdfBoth links point to the same file. Use download_link for most cases.
- π Getting Started Guide - Detailed tutorials and examples
- π API Reference - Complete API documentation
- π οΈ Developer Guide - For contributors and maintainers
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
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
TFLinkError- Base exceptionFileNotFoundError- File not foundUploadError- Upload failedAuthenticationError- Invalid credentialsNetworkError- Network request failed
pip install -e ".[dev]"make test # Run tests
make test-cov # Run with coverage
make quick-test # Quick functionality testmake format # Format code with black
make lint # Run linters (flake8, mypy)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
See CHANGELOG.md for version history and changes.
MIT License - see LICENSE file for details.
- PyPI: https://pypi.org/project/tflink/
- GitHub: https://github.com/tflink-tmpfile/tflink
- Documentation: https://github.com/tflink-tmpfile/tflink/tree/main/docs
- tmpfile.link: https://tmpfile.link
- Issues: https://github.com/tflink-tmpfile/tflink/issues
- Email: pypi@tmpfile.link
- π§ Email: pypi@tmpfile.link
- π Issues: GitHub Issues
- π Docs: Documentation
Made with β€οΈ for the tmpfile.link community