Release v0.3.1 (What’s new?).
Welcome to pyshortio Documentation¶
PyShortIO provides a clean, well-documented API client for the Short.io URL shortening service with comprehensive error handling and pagination support. It follows Pythonic design principles to make URL shortening operations intuitive and efficient.
Quick Start¶
from pyshortio.api import Client
# Initialize client with your API token
client = Client(token="your_api_token")
# Get your domain
response, domain = client.get_domain_by_hostname("your-domain.short.gy")
domain_id = domain.id
# Create a shortened link
response, link = client.create_link(
hostname="your-domain.short.gy",
original_url="https://example.com/very-long-url-path",
title="Example Link"
)
print(f"Shortened URL: {link.short_url}")
# List all your links
response, links = client.list_links(domain_id=domain_id)
for link in links:
print(f"{link.title}: {link.short_url} -> {link.original_url}")
🚀 Bulk URL Management with Sync TSV¶
Managing multiple Short.io links doesn’t have to be tedious! PyShortIO includes a powerful Sync TSV feature that lets you create, update, and delete hundreds of shortened URLs in a single operation using spreadsheet files. Maintain your links in Google Sheets, export as TSV, and sync them to Short.io with just a few lines of code. Perfect for marketing campaigns, documentation management, or any scenario requiring bulk URL operations.
# Install with sync dependencies
# pip install pyshortio[sync]
with open("links.tsv", "r") as file:
client.sync_tsv(hostname="yourdomain.short.gy", file=file)
Install¶
pyshortio is released on PyPI, so all you need is to:
$ pip install pyshortio
To upgrade to latest version:
$ pip install --upgrade pyshortio