Skip to main content

Official Python client for the Mecanik API: AI, security analysis, email, reports and developer utility endpoints.

Project description

Mecanik API (Python)

Official Python client for the Mecanik API: AI, security analysis, email, reports and developer utility endpoints. Pay-per-use credits, no subscription.

New accounts get 100 free credits. Grab your account UUID and an API token at members.mecanik.dev. Full reference: api.mecanik.dev/docs.

Install

pip install mecanik-api

Quick start

from mecanik_api import MecanikClient

mecanik = MecanikClient(account_id="YOUR_ACCOUNT_UUID", token="YOUR_API_TOKEN")

# Each tool returns just the `result`, and raises MecanikError on failure.
headers = mecanik.tools.security_headers(url="https://example.com")
print(headers["grade"], headers["score"])

tokens = mecanik.tools.token_counter(text="Hello world", models=["gpt-4o", "claude-sonnet-4-6"])
audit = mecanik.tools.website_audit(url="https://example.com")
balance = mecanik.credits()  # {"credits": ...}

Error handling

from mecanik_api import MecanikError

try:
    mecanik.tools.dns_lookup(domain="example.com")
except MecanikError as err:
    print(err.status, str(err), err.errors)
    # status 402 -> out of credits; 403 -> bad token; 429 -> rate limited

Lower-level access

# Full envelope {"result", "success", "errors"}
res = mecanik.raw("/tools/dns-lookup", {"domain": "example.com"})

# Any endpoint by path
result = mecanik.call("/tools/hash-generate", {"input": "hello", "algorithm": "sha256"})

Available tools

mecanik.tools.* provides one method per endpoint:

  • AI: ai_code_review, ai_content_summarize, ai_seo_generate, ai_translate, ai_chat, ai_image_generate, ai_extract, ai_alt_text, ai_moderation
  • Security: security_headers, tls_check, tech_detect, seo_analyze, dns_lookup, openapi_validate, subdomain_finder, exposed_files
  • Email: email_deliverability, email_validator, email_validator_bulk
  • Reports: website_audit, performance_audit, broken_link_checker, carbon_footprint
  • Utilities: qr_generate, placeholder_image, hash_generate, jwt_decode, password_strength, cron_explain, token_counter, json_to_code

Account helpers: account(), token_info(), credits(), list_tools().

The machine-readable spec is at api.mecanik.dev/openapi.json.

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

mecanik_api-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

mecanik_api-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file mecanik_api-1.0.0.tar.gz.

File metadata

  • Download URL: mecanik_api-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mecanik_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 daa33f175c1b1821780ba83345daceaf9939a7b5b34b21fab04a655cdc9aaabb
MD5 08f674f92c6790242300b4d6a8b2e879
BLAKE2b-256 a4c0bec848a2c113708f3ea3deffc1f379f4e91cef11e96e3244c436ba1c619f

See more details on using hashes here.

File details

Details for the file mecanik_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mecanik_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mecanik_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54512ccff87a526d8f11aad75e4c8f9f1d74039ba071e2b4f30eb16a3211495b
MD5 3da20f2836b806e3d41fd079fe4fb585
BLAKE2b-256 3bcbd0087a69f5923e072083354cc712f92d67880750d1676409292c052717d5

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