Skip to main content

Use Brevo API with Python (the easy way)

Project description

easybrevo

Use Brevo API with Python (the easy way).

Installation

pip install easybrevo

Usage

First of all, you have to instantiate an API client:

from easybrevo import ApiClient

client = ApiClient()

ApiClient() admits one argument api_key → Brevo API key (Generate from here).

If api_key is not provided, its value will be collected from BREVO_API_KEY within a .env file or as an environment variable. Otherwise an error will raise.

Sending an email

The quickest way to send an email is the following:

client.send_email(
    to="hello@example.com",
    subject="This is the subject",
    content="This is the content"
)

Sender

send_mail() admits arguments sender_email and sender_name in order to set sender information when sending the email.

If sender_email is not provided, its value will be collected from BREVO_SENDER_EMAIL within a .env file or as an environment variable. Otherwise an error will raise.

If sender_name is not provided, its value will be collected from BREVO_SENDER_NAME within a .env file or as an environment variable. Otherwise an error will raise.

Content type

By default, the content of the email is intepreted as plain text, but this behaviour can be changed with the argument content_type:

  • content_type='txt' → Text (default)
  • content_type='md' → Markdown
  • content_type='html' → HTML

Attachments

You can attach files to the email using attachments argument.

It can contain a single file (path) or a list of file paths to be included as attachments in the email.

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

easybrevo-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

easybrevo-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easybrevo-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.17

File hashes

Hashes for easybrevo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 37fe5a6bb0f8d021abd8384a6d6ba9747406981dbd2ad3064466c71bb55dc144
MD5 664cb4ae8903392b1e7c99ff25f34498
BLAKE2b-256 c276fa1bf9e5206e6ca123f08901be23515e94b48b9deb0fc5082a39967fa405

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easybrevo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.17

File hashes

Hashes for easybrevo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7356cc07e8766969f093f7326b2eb0240af4c6a4d6fa148a06f45207bb1a61c
MD5 f6bae1de001dfbe006740cb7dc3bacfd
BLAKE2b-256 93b7b6b729851483ec59fb51251fed6ef324fbcacfe981fb09cd7b66b342f22b

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