Skip to main content

Python SDK and CLI for the Bulko campaign automation API

Project description

Bulko Python

Dependency-free Python SDK and CLI for the Bulko API.

Install

pip install bulko

SDK

import os
from bulko import Bulko

client = Bulko(os.environ["BULKO_API_KEY"])

print(client.account.balance())

campaign = client.campaigns.launch(
    name="Product update",
    subject="A useful update for your team",
    body="<p>Hello, here is the update you requested.</p>",
    recipients=["alex@example.com", {"email": "sam@example.com", "name": "Sam"}],
    reply_to="replies@example.com",
)

print(client.campaigns.stats(campaign["id"]))

Available resources are campaigns, subscribers, replies, account, and smtp_accesses. AsyncBulko provides async helpers for read operations. API keys must remain server-side.

CLI

export BULKO_API_KEY=bulko_live_...

bulko balance
bulko campaign-stats 42
bulko replies --status positive --limit 25
bulko smtp-accesses
bulko import-subscribers contacts.txt --list-name "Webinar attendees"

Campaign launch is intentionally protected by an explicit flag:

bulko launch-campaign \
  --name "Product update" \
  --subject "A useful update" \
  --html-file message.html \
  --recipients-file recipients.txt \
  --confirm-send

Only send permission-based email that complies with the Bulko Acceptable Use Policy and applicable law.

Errors

HTTP failures map to typed exceptions: ValidationError, AuthenticationError, InsufficientCreditsError, ContentBlockedError, NotFoundError, and RateLimitError. Each API exception exposes status_code, response, and request_id.

Development

python -m pip install -e . ruff build
ruff check .
python -m unittest discover -s tests -v
python -m build

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

bulko-0.1.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

bulko-0.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file bulko-0.1.1.tar.gz.

File metadata

  • Download URL: bulko-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bulko-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d710fefffdb1f0a58ae300a9be19e4179bd7e3124e3897fccd738e04500188f7
MD5 6a14f2ad6b2adaab1098db2b18c93527
BLAKE2b-256 f32726e2cdd413f6ad5304421d2ba4a760d86dd6748a6319daae127e440a90bd

See more details on using hashes here.

File details

Details for the file bulko-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bulko-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bulko-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72f80c04bbcb68cc936cb751d0a0148c8c15099950d269fac98c4c2adc8a1935
MD5 b094f38ae20c65450d37430a442fd7b3
BLAKE2b-256 af14f2b641cfa6da1180c011c25fa712df55ba01e2b5fdb90783feeff68813f3

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