Skip to main content

SendGrid library for Python

Project description

Travis Badge

This library allows you to quickly and easily use the SendGrid Web API via Python.

Announcements

BREAKING CHANGE as of 2016.06.14

Version 3.0.0 is a breaking change for the entire library.

Version 3.0.0 brings you full support for all Web API v3 endpoints. We have the following resources to get you started quickly:

Thank you for your continued support!

All updates to this library is documented in our CHANGELOG.

Installation

Setup Environment Variables

First, get your free SendGrid account here.

Next, update your environment with your SENDGRID_API_KEY.

echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env

Install Package

pip install sendgrid

or

easy_install sendgrid

Dependencies

Quick Start

Hello Email

import sendgrid
from sendgrid.helpers.mail import *

from_email = Email("test@example.com")
subject = "Hello World from the SendGrid Python Library"
to_email = Email("test@example.com")
content = Content("text/plain", "some text here")
mail = Mail(from_email, subject, to_email, content)
response = sg.client.mail.send.post(request_body=mail.get())
print(response.status_code)
print(response.body)
print(response.headers)

General v3 Web API Usage

import sendgrid

sg = sendgrid.SendGridAPIClient()
response = sg.client.api_keys.get()
print(response.status_code)
print(response.body)
print(response.headers)

Usage

Roadmap

If you are intersted in the future direction of this project, please take a look at our milestones. We would love to hear your feedback.

How to Contribute

We encourage contribution to our libraries, please see our CONTRIBUTING guide for details.

Quick links:

About

sendgrid-python is guided and supported by the SendGrid Developer Experience Team.

sendgrid-python is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-python are trademarks of SendGrid, Inc.

SendGrid Logo

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sendgrid-3.0.0.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

sendgrid-3.0.0-py2-none-any.whl (18.9 kB view hashes)

Uploaded Python 2

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