The official Python SDK for dco.ink - A minimalist and developer-friendly URL shortener
Project description
dcoink - Official Python SDK for dco.ink
The official, beautifully typed Python SDK for dco.ink - the minimalist, privacy-first URL shortener.
Installation
pip install dcoink
Quick Start (Anonymous Mode)
You don't even need an account to start shortening URLs! The SDK provides a blazing-fast anonymous mode.
import dcoink
link = dcoink.shorten("https://example.com/a-very-long-url-that-needs-shortening")
print(f"Short URL: {link.short_url}")
# Output: https://dco.ink/xyz123
Authenticated Mode
By passing your API Key, you can manage your links and access advanced features (like specifying custom short codes).
import dcoink
link = dcoink.shorten(
"https://example.com/my-campaign",
custom_code="mybrand",
api_key="dco_xxxxxx"
)
print(link.short_url)
# Output: https://dco.ink/mybrand
Advanced Usage (Client API)
For robust applications, use the Client to manage your links, check history, and more.
from dcoink import Client
with Client(api_key="dco_xxxxxx") as client:
# Get user info
me = client.get_me()
print(f"Logged in as {me.name}")
# Create a link
link = client.create_link("https://github.com", custom_code="git")
# List history
links = client.list_links(limit=10)
for l in links:
print(l.short_url, l.clicks)
# Update and delete
client.update_link("git", "https://github.com/new-target")
client.delete_link("git")
Async Support
Building high-concurrency scrapers or bots? We've got you covered with AsyncClient powered by httpx.
import asyncio
from dcoink import AsyncClient
async def main():
async with AsyncClient(api_key="dco_xxxxxx") as client:
link = await client.create_link("https://example.com")
print(link.short_url)
asyncio.run(main())
Built-in CLI Tool
When you install the SDK, you also get a neat terminal command!
# Quick shorten
dcoink shorten https://example.com
# Custom short code
dcoink shorten https://example.com -c mybrand -k dco_xxxxxx
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 dcoink-0.1.1.tar.gz.
File metadata
- Download URL: dcoink-0.1.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3366469671e96bcb9b920e572141806ccb41b2b9024dd21c616d4c2b07520aaa
|
|
| MD5 |
9823c84e5c610a9476fca01aa0808e86
|
|
| BLAKE2b-256 |
bb5ec0e99da6879b0e1faebbf53280f99551296abb06e529388fe1084a828351
|
File details
Details for the file dcoink-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dcoink-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e26d255cdc613d5c2706d615e2af3b6cd2ad7862d1095b136a7c7605bf9ebc
|
|
| MD5 |
15318b0d0341be5e3e596d99aa5a2908
|
|
| BLAKE2b-256 |
263c0895a60411500aaa82ed2f67af03fcfdf4086daaecaa0ee19df6017c8f44
|