CastBricks Docs

Python

Install and use the CastBrick Python SDK

Python SDK

Install:

pip install castbrick

Initialize:

from castbrick import CastBrick

client = CastBrick(api_key=os.environ['CASTBRICK_API_KEY'])

Send email:

resp = client.email.send(
  from_='no-reply@yourdomain.com',
  to=['alice@example.com'],
  subject='Welcome',
  html='<p>Hello Alice</p>'
)
print(resp.id, resp.status)

Send SMS:

resp = client.sms.send(
  from_='+15551234567',
  to=['+15557654321'],
  body='Your code is 123456'
)
print(resp.id, resp.status)

Templates and error handling follow similar patterns to the JavaScript SDK.

On this page