Skip to main content

Utilities and tools for my apis and other life hacks.

Project description

icakad

Lightweight Python client for managing short links hosted on the linkove.icu worker.
The package exports a small set of helpers that wrap the service API so automations and scripts can add, edit, delete, or list slugs without hand-crafting HTTP requests.

Highlights

  • Minimal footprint: only depends on requests
  • Module-level configuration for base URL, bearer token, and debug logging
  • Uniform response handling that normalises the list endpoint payload

Installation

pip install icakad

Install requests separately if it is not already available in your environment.

Quick Start

from icakad import add_link, edit_link, delete_link, list_links
from icakad import shorturl

# Configure credentials and optional debugging up front
shorturl.HEADERS["Authorization"] = "Bearer <your-token>"
shorturl.DEBUG = False

# Create or overwrite a slug
add_link(slug="docs", url="https://example.com/docs")

# Update an existing slug
edit_link(slug="docs", new_url="https://example.com/documentation")

# Fetch the full catalogue
links = list_links()
print(links.get("docs"))

# Remove a slug
delete_link(slug="docs")

Each helper returns the JSON body produced by the worker. Inspect it for status codes, error messages, or additional metadata.

API Reference

All helpers live in icakad.shorturl and are re-exported at the package root for convenience.

Function Description
add_link(slug: str, url: str) -> dict Create or overwrite a slug with the target URL.
edit_link(slug: str, new_url: str) -> dict Update an existing slug. Backed by POST /api/<slug>.
delete_link(slug: str) -> dict Delete the slug via DELETE /api/<slug>.
list_links() -> dict[str, str] Retrieve all slugs. Normalises both list-style and {"items": [...]} payloads.

Configuration

Tweak behaviour by adjusting attributes on icakad.shorturl:

  • BASE: API root (default https://linkove.icu). Point this elsewhere for staging or local testing.
  • HEADERS: Dictionary of headers supplied with every request. Set the bearer token here.
  • DEBUG: When True, prints HTTP status codes and JSON responses to stdout.

Feel free to override the module-level requests usage with your own session or retry logic by wrapping these helpers.

Error Handling Tips

  • Wrap calls in try/except requests.RequestException for transport-level issues.
  • Validate mandatory keys in the returned JSON before relying on them.
  • Enable DEBUG when tuning your worker or troubleshooting authentication.

Development

Clone the repository and install it in editable mode:

pip install -e .

Build packages:

python -m build

Run any tests or scripts you add:

python -m pytest

Contributions that improve ergonomics (e.g., async helpers, richer error handling) are welcome.

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

icakad-0.1.4.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

icakad-0.1.4-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file icakad-0.1.4.tar.gz.

File metadata

  • Download URL: icakad-0.1.4.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for icakad-0.1.4.tar.gz
Algorithm Hash digest
SHA256 845e9ea4c65238f4977ada64e6a6b7a2f6e8bf7655e3758d5fd0bfbe0905c088
MD5 4980c78b2eee11586b93559c409372d0
BLAKE2b-256 0e033fce253b37c2d983e3acfe9f2bbe885d8291ccf363fd91ca1d12b7991e30

See more details on using hashes here.

File details

Details for the file icakad-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: icakad-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for icakad-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5e24d5b90fee6df2939ee8ecda38c6827a3c42231e9cae8bedb370174d25edae
MD5 0597195c099b17f51793a0ec73fcba24
BLAKE2b-256 943c8c62756acd9e42a557161970f1a674471d55c8a5ab4dbe4657b934445180

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