Python client for the SpeedyShort URL shortener.
Project description
speedyshortpy
speedyshortpy is a small Python client for the SpeedyShort
URL shortener.
It provides a thin wrapper around the HTTP API so you can create short links from Python code with a single call.
Installation
Once published on PyPI:
pip install speedyshortpy
For local development, you can install it from the cloned repository:
pip install -e .
Usage
By default the client targets a local SpeedyShort instance on http://localhost:8080:
from speedyshortpy import SpeedyShortClient
client = SpeedyShortClient() # base_url="http://localhost:8080"
result = client.shorten("https://www.example.com")
print(result.code)
print(result.short_url)
print(result.target_url)
You can also point it to a remote instance, for example the public demo:
client = SpeedyShortClient(base_url="https://syrt.cc")
Resolving a short code
You usually do not need a client for redirects, but if you want to inspect the redirect response:
resp = client.resolve("a7X9pQ", follow_redirects=False)
print(resp.status_code) # 301 if active, 451 if blocked
print(resp.headers.get("Location"))
A blocked link returns HTTP 451 instead of a redirect.
Reporting a link
You can report a short link for abuse. The url parameter accepts a short
code, a full short URL, or a full external URL — the server resolves the
domain automatically.
# Using just the short code
client.report("a7X9pQ", reason="This link points to a phishing page")
# Using the full short URL
client.report("https://syrt.cc/a7X9pQ", reason="This link points to a phishing page")
# Using a full external URL
client.report("https://malicious.com/page", reason="Malware distribution site")
The reason must be between 10 and 100 characters. A ValueError is raised
client-side if the constraint is not met. The report is queued for manual review
and does not immediately block the link.
Rate limit: 3 reports per IP per day.
License
This client library is released under the same license as the main project: Prosperity Public License 3.0.0.
Commercial use requires a commercial license from the copyright holder.
Project details
Release history Release notifications | RSS feed
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 speedyshortpy-0.2.0.tar.gz.
File metadata
- Download URL: speedyshortpy-0.2.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
453ee2d55c8aad08c271b9e96177be57ad25482566874ea8a38c255cad69fef6
|
|
| MD5 |
ac123d190c460e066e31ad08e8bc305b
|
|
| BLAKE2b-256 |
2166f83723ac322980436aa2562f40daf13894b9cce86814b054810e3c615b2d
|
File details
Details for the file speedyshortpy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: speedyshortpy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd696a72b6f42bd65d9d01c77e9e3674373fac67b7c53f223394a0a2b32db7c1
|
|
| MD5 |
3b7d9eb7e9d13cbc7e9edd1ab5d85422
|
|
| BLAKE2b-256 |
246dabdcdd453bbdda8e9d202bf4fad7541b1f255fad9a4f602ac0019fae928b
|