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, email_spam_check, email_header_analyzer, email_blacklist_check
  • 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.1.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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mecanik_api-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 715b383dd92f7e7dd9e3d74590e2b1e3ef0508d390a59f24c1128739643ecd37
MD5 d21501aab7fce6b75e50035a55818dcb
BLAKE2b-256 4fd62221dc05ba07a3ca1f4ff1ab90a949466b37d4dc9033b2f5df4cccba8e2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mecanik_api-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e85f85d200277c3ba873118c9a0febb220980f027776cb82851880e1d3f33515
MD5 71a1902c491f75dd672822e7913b6d67
BLAKE2b-256 015e54e6aad8ec598afb2d6436954dde966ce3a9006755724e4aa32acf15eacc

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