Skip to main content

Python SDK for mailbot — Programmable email infrastructure for developers

Project description

mailbot

Python SDK source for the mailbot API.

Default API base: https://agentmail.omyop.com/v1

Current status: package is prepared for public install once registry credentials are available.

Sync quick start

from mailbot import MailBot

client = MailBot(api_key="mb_xxx")
inbox = client.inboxes.create(username="support-bot")

Domain onboarding

domain = client.domains.create(domain="myapp.com")
print(domain["dns_records"])

records = client.domains.get(domain["id"])
print(records["dns_records"])

verified = client.domains.verify(domain["id"])
print(verified["data"]["status"])
print(verified["next_step"])

Async quick start

import asyncio
from mailbot import MailBot

async def main():
    async with MailBot(api_key="mb_xxx") as client:
        await client.http.arequest("GET", "/usage")

asyncio.run(main())

Webhook handling

import hmac
import hashlib

def verify_webhook(body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)

Compliance checking

client.compliance.check(domain="example.com")
client.compliance.readiness(inbox_id="inbox_123")

CI/email testing

result = client.messages.wait_for(
    "inbox_123",
    direction="inbound",
    subject_contains="Verify your account",
    timeout_ms=20000,
)

print(result["data"]["subject"])

Error handling

from mailbot import MailBot, AuthError, RateLimitError

client = MailBot(api_key="mb_xxx")

try:
    client.inboxes.list()
except AuthError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests")

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

mailbot_sdk-0.1.0b2.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

mailbot_sdk-0.1.0b2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file mailbot_sdk-0.1.0b2.tar.gz.

File metadata

  • Download URL: mailbot_sdk-0.1.0b2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mailbot_sdk-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 7f097ac0ce255800a7e89224db373816e01ed4207f5416575559aa214fa25a57
MD5 860c74e89f3cd868d613fea8e2b82aeb
BLAKE2b-256 e2e544f57719b9969f18e1c867d579f3a23ba8763e6a59fcaf9e800402a6d783

See more details on using hashes here.

File details

Details for the file mailbot_sdk-0.1.0b2-py3-none-any.whl.

File metadata

  • Download URL: mailbot_sdk-0.1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mailbot_sdk-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ae94f16eedb015020a1df84d29c87b7758f47905f7301f711d287707a7cb137
MD5 516cab6ad5a420585be8e47d3a66d478
BLAKE2b-256 c8ca7cc719ea3ff4adc0b935699ee1db1925e0342f2e2d1c95497558bb09c668

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