tly-url-shortener-api
Python SDK for the T.LY URL Shortener API.
Features
- Typed Python client with sensible defaults.
- Built-in bearer auth handling.
- Binary or JSON responses for QR endpoints.
- CLI entry point (
tly) for quick scripts and terminal usage. - PyPI-ready packaging (
pyproject.toml) and tests.
Installation
pip install tly-url-shortener-api
For local development:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Quick Start
from tly_url_shortener import TlyClient
client = TlyClient(api_token="YOUR_TLY_API_TOKEN")
created = client.create_short_link(
long_url="https://example.com/landing-page",
description="Campaign link",
public_stats=True,
)
print(created["short_url"])
expanded = client.expand_short_link(short_url=created["short_url"])
print(expanded["long_url"])
Endpoint Coverage
OneLink Stats Management
get_onelink_statsdelete_onelink_stats
ShortLink Management
create_short_linkget_short_linkupdate_short_linkdelete_short_linkexpand_short_linklist_short_linksbulk_shorten_linksbulk_update_links
ShortLink Stats
get_link_stats
UTM Preset Management
create_utm_presetlist_utm_presetsget_utm_presetupdate_utm_presetdelete_utm_preset
OneLink Management
list_onelinks
Pixel Management
create_pixellist_pixelsget_pixelupdate_pixeldelete_pixel
QR Code Management
get_qr_codeupdate_qr_code
Tag Management
list_tagscreate_tagget_tagupdate_tagdelete_tag
CLI Usage
Set token once:
export TLY_API_TOKEN="YOUR_TLY_API_TOKEN"
Create short link:
tly shorten --long-url "https://example.com"
Expand short link:
tly expand --short-url "https://t.ly/abc123"
Call any client method:
tly call create_tag --data '{"tag":"fall2026"}'
Retrieve QR image:
tly qr --short-url "https://t.ly/abc123" --out qr.png
Development
pytest
ruff check .
python -m build
twine check dist/*
Publish to PyPI
python -m build
twine check dist/*
twine upload dist/*
If you use trusted publishing in GitHub Actions, replace the final twine upload with your CI release workflow.
License
MIT
Metadata
Release files for tly-url-shortener-api 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tly_url_shortener_api-0.1.0.tar.gz | 8.6 kB | Without provenance | Details for tly_url_shortener_api-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tly_url_shortener_api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tly_url_shortener_api-0.1.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / tly_url_shortener_api-0.1.0.tar.gz
| Download URL | tly_url_shortener_api-0.1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfa072d1dfb724f933208885601335bbd71a499829a1f421d7bcfb88828d4bcb
|
|
BLAKE2b-256 checksum How to use checksums |
7772978e7baf53e563a62ec1a7d6161be5449a927c171c9b08ddaa0ac78302b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / tly_url_shortener_api-0.1.0-py3-none-any.whl
| Download URL | tly_url_shortener_api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27e39755afc7447dcf471f6960472614cb4f2a9e4a21ca0733899e276a1f3fa6
|
|
BLAKE2b-256 checksum How to use checksums |
2c6fc3683ba5bdd25ccc4c68a87ab0c5f21ffb1ebe4ffc0997de0ee15f49dde0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for tly-url-shortener-api 0.1.0
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.