Skip to main content

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)
print(resp.headers.get("Location"))

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speedyshortpy-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speedyshortpy-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file speedyshortpy-0.1.1.tar.gz.

File metadata

  • Download URL: speedyshortpy-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for speedyshortpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9fe829f6ad767e3defd15fbfa264e9dfbc3a9f052610265117ae49e9db359802
MD5 af169b30d681fcbf4f527e76a1c4e73c
BLAKE2b-256 425451c6f3c12f19b057282d0ea957ed63aa6b2a66bac528eb9fcb1312f82ea2

See more details on using hashes here.

File details

Details for the file speedyshortpy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: speedyshortpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for speedyshortpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b239ec40ceec2ffb816e50222c326189f573ab9bebae3a8218c7cd1e7fae05
MD5 c6a1ce5e9b776224f33cf1ee7cb715e2
BLAKE2b-256 d5bacecdab4ae1fcfdaa6ebd41fbb0d2e1313eb3e4c437a07b530f146aa20388

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page