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.0.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.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: speedyshortpy-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 dee7ce48edcf77eefe3804aba7658e432c8d7b35845e39d5b353ab9657bcb835
MD5 f4aee4ab2dbbfc7aeb384b22ffa5a244
BLAKE2b-256 bcb5322a77c159974fdf9ea9d508a843e62ede53c86e603e4672869cfad89200

See more details on using hashes here.

File details

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

File metadata

  • Download URL: speedyshortpy-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ee00c3a4408b564a6544658858ee916b7f9c81072cb2aac140e166f364d7ac7
MD5 c84ba1210026ac687b1d94da692e9ac6
BLAKE2b-256 71b8c10e0cbe1cf23aa33ad496a10e6d2d76989ff88a4c64386ce63c0b33f447

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