Skip to content

codevbus/sendgrid-python

Repository files navigation

Travis Badge

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

Announcements

**NOTE: The /mail/send/beta endpoint is currently in beta!

Since this is not a general release, we do not recommend POSTing production level traffic through this endpoint or integrating your production servers with this endpoint.

When this endpoint is ready for general release, your code will require an update in order to use the official URI.

By using this endpoint, you accept that you may encounter bugs and that the endpoint may be taken down for maintenance at any time. We cannot guarantee the continued availability of this beta endpoint. We hope that you like this new endpoint and we appreciate any feedback that you can send our way.**

All updates to this library is documented in our CHANGELOG.

Installation

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

TRYING OUT THE V3 BETA MAIL SEND

git clone -b v3beta --single-branch https://github.com/sendgrid/sendgrid-python.git
cd sendgrid-python
cp examples/helpers/mail/mail_example.py .
  • Update the to and from emails.
python mail_example.py

TRYING OUT THE V3 BETA WEB API

git clone -b v3beta --single-branch https://github.com/sendgrid/sendgrid-python.git

Once we are out of v3 BETA, the following will apply

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.beta.post(request_body=mail.get())
print(response.status_code)
print(response.response_body)
print(response.response_headers)

General v3 Web API Usage

import sendgrid

sg = sendgrid.SendGridAPIClient()
response = sg.client.api_keys.get()
print(response.status_code)
print(response.response_body)
print(response.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] (https://assets3.sendgrid.com/mkt/assets/logos_brands/small/sglogo_2015_blue-9c87423c2ff2ff393ebce1ab3bd018a4.png)

About

Official Python Client Library for the SendGrid Web API

Resources

License

Code of conduct

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Python 98.0%
  • Shell 1.8%
  • HTML 0.2%