Skip to main content

aiosendgrid

A simple SendGrid asynchronous client based on httpx.

Installation

pip install aiosendgrid

Or, to include the optional SendGrid helpers support, use:

pip install aiosendgrid[helpers]

Usage

With Mail Helper Class

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

SENDGRID_API_KEY = "SG.XXX" 

from_email = Email("test@example.com")
to_email = To("test@example.com")
subject = "Sending with SendGrid is Fun"
content = Content("text/plain", "and easy to do anywhere, even with Python")
mail = Mail(from_email, to_email, subject, content)

async with aiosendgrid.AsyncSendGridClient(api_key=SENDGRID_API_KEY) as client:
    response = await client.send_mail_v3(body=mail.get())

More info on sendgrid-python official repository.

Without Mail Helper Class

import aiosendgrid

SENDGRID_API_KEY = "SG.XXX"

data = {
    "personalizations": [
        {
            "to": [{"email": "test@example.com"}],
            "subject": "Sending with SendGrid is Fun",
        }
    ],
    "from": {"email": "test@example.com"},
    "content": [
        {"type": "text/plain", "value": "and easy to do anywhere, even with Python"}
    ],
}

async with aiosendgrid.AsyncSendGridClient(api_key=SENDGRID_API_KEY) as client:
    response = await client.send_mail_v3(body=data)

Release files for aiosendgrid 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiosendgrid 0.1.0
File Size Uploaded
aiosendgrid-0.1.0.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiosendgrid 0.1.0
File Interpreter ABI Platform
aiosendgrid-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.1 kB

Release files / aiosendgrid-0.1.0.tar.gz

Download URL aiosendgrid-0.1.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a6885729a0ed29e6e7ea2e6ecaad73a31a1699a2418530c75694f8c76c6987d9
BLAKE2b-256 checksum
How to use checksums
60b199d78ad343fa953977ff02ce3553d5e94a5ab93d28a35caf941db1853c75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Darwin/19.6.0

Release files / aiosendgrid-0.1.0-py3-none-any.whl

Download URL aiosendgrid-0.1.0-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab8abc62db477e08b21cb83243b56b40316c2c9365c86f2b72bca156f32a7ca4
BLAKE2b-256 checksum
How to use checksums
27fac21efe03089d3231e4a142341ecd759c1fbab01f401d67a38999328c35cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page