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 a dumb default value is used.

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 a dumb default value is used.

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.2.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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easybrevo-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7fb7bd0858aa98a9b7609539d7b3ba24a5e288be01e37e15e0a28ecb39214e18
MD5 9c13b4688004b07a63b73d93fb7c2663
BLAKE2b-256 7b8c81df22b75dd653baccc22b2540bd56140904363f5a1360abf1f8d25566c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easybrevo-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dce3e332222eed4a8cef1d543648dbb3f7194fd90781b064ea372869249c1576
MD5 685233e105e9abe0e91fd6e6063ee922
BLAKE2b-256 05a7ff4f85d970f182729cf16a9f8735be8a5c881ab1523fc5747ca727f57b1a

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