From 3169805808b73f98aee140ff7aa4fe1468ad42b6 Mon Sep 17 00:00:00 2001 From: Elmer Thomas Date: Tue, 17 Nov 2015 00:11:45 -0800 Subject: [PATCH 1/2] Added api_keys POST, PATCH, DELETE --- README.rst | 23 +++++++++++++++++++++++ example_v2_test.py | 6 ++++-- example_v3_test.py | 13 ++++++------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 57b5514ee..3b79e1c2e 100644 --- a/README.rst +++ b/README.rst @@ -248,6 +248,29 @@ List all API Keys belonging to the authenticated user. client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) status, msg = client.apikeys.get() +Generate a new API Key for the authenticated user + +.. code:: python + + client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) + name = "My Amazing API Key" + status, msg = client.apikeys.post(name) + +Revoke an existing API Key + +.. code:: python + + client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) + status, msg = client.apikeys.delete(api_key_id) + +Update the name of an existing API Key + +.. code:: python + + client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) + name = "My NEW API Key 3000" + status, msg = client.apikeys.patch(api_key_id, name) + `Suppression Management`_ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/example_v2_test.py b/example_v2_test.py index 37410a136..ec8c6219b 100755 --- a/example_v2_test.py +++ b/example_v2_test.py @@ -9,12 +9,14 @@ sg = sendgrid.SendGridClient(os.environ.get('SENDGRID_USERNAME'), os.environ.get('SENDGRID_PASSWORD')) """ +to = 'Jane Doe ' +from = 'John Doe ' message = sendgrid.Mail() -message.add_to('Elmer Thomas ') +message.add_to(to) message.set_subject('Testing from the Python library') message.set_html('This was a successful test!') message.set_text('This was a successful test!') -message.set_from('Elmer Thomas ') +message.set_from(from) status, msg = sg.send(message) print status print msg diff --git a/example_v3_test.py b/example_v3_test.py index d12ed78ac..419bec2b7 100755 --- a/example_v3_test.py +++ b/example_v3_test.py @@ -11,8 +11,7 @@ client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) """ - -email = 'elmer.thomas+test_global0@gmail.com' +email = 'example@example.com' status, msg = client.asm_global_suppressions.delete(email) print status print msg @@ -21,7 +20,7 @@ print status print msg -status, msg = client.asm_global_suppressions.post(['elmer.thomas+test_global0@gmail.com']) +status, msg = client.asm_global_suppressions.post(['example@example.com']) print status print msg @@ -47,12 +46,12 @@ print msg # In the global suppression list -status, msg = client.asm_global_suppressions.get('elmer.thomas+test_global@gmail.com') +status, msg = client.asm_global_suppressions.get('example@example.com') print status print msg # Not in the global suppression list -status, msg = client.asm_global_suppressions.get('elmer.thomas@gmail.com') +status, msg = client.asm_global_suppressions.get('example@example.com') print status print msg @@ -60,11 +59,11 @@ print status print msg -status, msg = client.asm_suppressions.delete(67,'elmer+test@thinkingserious.com') +status, msg = client.asm_suppressions.delete(67,'example@example.com') print status print msg -status, msg = client.asm_suppressions.post(60, ['elmer+test@thinkingserious.com', 'elmer.thomas@yahoo.com']) +status, msg = client.asm_suppressions.post(60, ['example@example.com', 'example@example.com]) print status print msg From 24fa26edc9acbff48a10202a3b7562058464f4cf Mon Sep 17 00:00:00 2001 From: Elmer Thomas Date: Tue, 17 Nov 2015 00:16:22 -0800 Subject: [PATCH 2/2] Version Bump 1.5.15 --- CHANGELOG.md | 6 ++++++ sendgrid/version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf8077f6..15171cccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +## [1.5.15] - 2015-11-17 ## + +### Added ### + +- API Keys documentation for [POST, PATCH, DELETE] + ## [1.5.14] - 2015-11-09 ## ### Fixed ### diff --git a/sendgrid/version.py b/sendgrid/version.py index 3adbd2949..9b955d82f 100644 --- a/sendgrid/version.py +++ b/sendgrid/version.py @@ -1,2 +1,2 @@ -version_info = (1, 5, 14) +version_info = (1, 5, 15) __version__ = '.'.join(str(v) for v in version_info)