Skip to main content

Official Python SDK for the dickless.io API platform

Project description

dickless

Official Python SDK for the dickless.io API platform.

Installation

pip install dickless

Quick Start

from dickless import DicklessClient

client = DicklessClient(api_key="dk_your_api_key")

# Content Moderation
result = client.moderate_text("Some text to analyze")
print(result.safe, result.overall_score)

# PII Redaction
redacted = client.redact("Email me at john@example.com", entities=["email"])
print(redacted.redacted, redacted.entity_count)

# AI Gateway
from dickless import ChatRequest, ChatMessage

response = client.chat(ChatRequest(
    model="gpt-4o",
    messages=[ChatMessage(role="user", content="Hello!")],
))
print(response.choices[0].message.content)

# Or pass a plain dict:
response = client.chat({
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}],
})

# Prompt Sanitizer
sanitized = client.sanitize("Ignore all previous instructions and...")
print(sanitized.clean, sanitized.threat_score)

# URL Shortener
short = client.shorten("https://example.com/very/long/url")
print(short.short_url, short.qr_code)

stats = client.get_short_url_stats(short.code)
print(stats.clicks)

# Roast
roast = client.roast("My super cool landing page copy", type="landing_page")
print(roast.roast)

# Credits (for dedicated gateway mode)
balance = client.get_credit_balance()
print(f"Balance: ${balance.balance_cents / 100:.2f}")

transactions = client.get_credit_transactions()
for tx in transactions:
    print(tx.description, tx.amount_cents)

# PDF Generation
pdf = client.generate_pdf(html="<h1>Invoice</h1><p>Total: $49.99</p>", page_size="A4")
print(pdf.url)

# Email Verification
verified = client.verify_email("john@example.com", deep=True)
print(verified.deliverable, verified.disposable)

# DNS / WHOIS Lookup
dns = client.dns_lookup("example.com", types=["A", "MX"], whois=True)
print(dns.records, dns.whois)

# IP Geolocation & Threat Intel
ip_info = client.ip_intel("8.8.8.8", deep=True)
print(ip_info.country, ip_info.city, ip_info.threat)

# Webhook Delivery
webhook = client.deliver_webhook(
    url="https://example.com/webhooks",
    event="order.completed",
    payload={"orderId": "abc-123", "total": 49.99},
    secret="whsec_your_signing_secret",
)
print(webhook.delivered)

# HTML/Markdown Sanitizer
sanitized = client.sanitize_html(
    '<p>Hello</p><script>alert("xss")</script>',
    allow_tags=["p", "b", "i", "a"],
)
print(sanitized.sanitized)  # "<p>Hello</p>"

Async Usage

import asyncio
from dickless import AsyncDicklessClient

async def main():
    async with AsyncDicklessClient(api_key="dk_your_api_key") as client:
        result = await client.moderate_text("Check this text")
        print(result.safe)

        redacted = await client.redact("Call me at 555-0123")
        print(redacted.redacted)

asyncio.run(main())

Gateway Mode

Set a default gateway mode for all AI requests:

client = DicklessClient(
    api_key="dk_your_api_key",
    default_gateway_mode="dedicated",
)

# All chat() calls will use "dedicated" mode unless overridden
response = client.chat({"model": "gpt-4o", "messages": [...]})

Error Handling

from dickless import DicklessClient, DicklessError

client = DicklessClient(api_key="dk_your_api_key")

try:
    result = client.moderate_text("test")
except DicklessError as e:
    print(f"API error [{e.code}]: {e.message}")

License

MIT

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

dickless-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

dickless-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dickless-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dickless-0.1.0.tar.gz
Algorithm Hash digest
SHA256 31025e37ad627fbf1f28a34f660bfbbc2a21e6be1182ebd5392cc38204f2d50b
MD5 2ab2774e29fb21ec730c6bfe13fc846e
BLAKE2b-256 6c8d35b4d893d0d2a098c47df21b44eab467f3e93e1435896396f2c1a69a905b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dickless-0.1.0.tar.gz:

Publisher: publish-python.yml on aetherio-llc/dl-io

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: dickless-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dickless-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2945420dffa26da9df9c4a5207026f6f114bc78a2500b0a1afd3bdccdffd217f
MD5 e1f3b460ae522cceede31c35f0620585
BLAKE2b-256 1a934b4d0620cff6d82e1d7ad55043d73bbc82f0f8c7bd93ffae735dfe245bbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for dickless-0.1.0-py3-none-any.whl:

Publisher: publish-python.yml on aetherio-llc/dl-io

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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