Skip to main content

SendGrid using a client based on httpx.

Project description

Python Python
Package PyPI Latest Release PyPI Downloads
Meta License - MIT


Sendgrid-Async is a simple asynchronous client built upon the httpx library.


You can install Sendgrid-Async using pip with the following command:

pip install sendgrid-async


Here is a brief script demonstrating how to send an email using Async-Sendgrid:

First, import the SendgridAPI from the sendgrid-async package. Then, create a SendgridAPI object using your API key.

from async_sendgrid import SendgridAPI
import os

API_KEY = os.environ.get('SECRET_API_KEY')
sendgrid = SendgridAPI(API_KEY)

Next, we can create an email using the original sendgrid library as follows:

from sendgrid.helpers.mail import Content, Email, Mail, To

from_email = Email("")
to_email = To("")
subject = "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
content = Content("text/plain", "Sed varius ligula ac urna vehicula ultrices. Nunc ut dolor sem.")

mail = Mail(

An email can be sent to sendgrid servers with the send API of the SendgridAPI instance:

async with sendgrid as client:
    response = await client.send(data)

For testing purposes, you can modify the API endpoint as follows:

sendgrid = SendgridAPI(api_key="SECRET_API_KEY", endpoint="https://localhost:3000/v3/mail/send")

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

sendgrid_async-2.0.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

sendgrid_async-2.0.1-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page