-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: geolocation setter in sendgrid-python for GDPR compliance
- Loading branch information
1 parent
4019024
commit 6ceb524
Showing
3 changed files
with
18 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,10 @@ | |
|
||
# Example 1 | ||
# setting region to be "global" | ||
sg = sendgrid.SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY')) | ||
sg.set_region("global") | ||
# sg = sendgrid.SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY')) | ||
|
||
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) | ||
sg.set_data_residency("global") | ||
from_email = Email("[email protected]") | ||
to_email = To("[email protected]") | ||
subject = "Sending with SendGrid is Fun" | ||
|
@@ -19,10 +21,12 @@ | |
print(response.body) | ||
print(response.headers) | ||
|
||
|
||
# Example 2 | ||
# setting region to "eu" | ||
sg = sendgrid.SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY')) | ||
sg.set_region("eu") | ||
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) | ||
sg.set_host("https://api.eu.sendgrid.com") | ||
# sg.set_data_residency("eu") | ||
from_email = Email("[email protected]") | ||
to_email = To("[email protected]") | ||
subject = "Sending with SendGrid is Fun" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters