From 8f60667aae775899f9e9048089d969f6bf83bbd0 Mon Sep 17 00:00:00 2001 From: Rich Leland Date: Sat, 3 Oct 2015 21:24:00 -0400 Subject: [PATCH 1/2] Add editorconfig file --- .editorconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d6a26d5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.py] +indent_style = space +indent_size = 4 From 6b24b986414ea45728c8344f732a1c549e93464b Mon Sep 17 00:00:00 2001 From: Rich Leland Date: Sat, 3 Oct 2015 21:24:20 -0400 Subject: [PATCH 2/2] Remove YOUR API KEY from examples --- .../recipient_lists/create_recipient_list.py | 2 +- .../recipient_lists/delete_recipient_list.py | 2 +- .../recipient_lists/get_recipient_list.py | 2 +- .../get_recipient_list_with_recipients.py | 2 +- .../recipient_lists/list_recipient_lists.py | 2 +- .../recipient_lists/update_recipient_list.py | 2 +- .../create_suppression_entries_bulk.py | 2 +- .../create_suppression_entry.py | 2 +- .../delete_suppression_entry.py | 2 +- .../suppression_list/get_suppression_entry.py | 2 +- .../list_suppression_entries.py | 2 +- .../update_suppression_entries_bulk.py | 2 +- .../update_suppression_enty.py | 2 +- examples/templates/create_template.py | 4 +- examples/templates/delete_template.py | 2 +- examples/templates/get_template.py | 2 +- examples/templates/list_templates.py | 2 +- examples/templates/preview_draft_template.py | 2 +- examples/templates/preview_template.py | 2 +- examples/templates/update_template.py | 2 +- examples/transmissions/find_transmission.py | 6 +- examples/transmissions/get_transmissions.py | 2 +- examples/transmissions/send_transmission.py | 60 +++++++++---------- .../transmissions/transmission_stored_list.py | 38 ++++++------ .../transmission_stored_template.py | 8 +-- 25 files changed, 79 insertions(+), 77 deletions(-) diff --git a/examples/recipient_lists/create_recipient_list.py b/examples/recipient_lists/create_recipient_list.py index 43891e3..9e54ea2 100644 --- a/examples/recipient_lists/create_recipient_list.py +++ b/examples/recipient_lists/create_recipient_list.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() response = sp.recipient_lists.create( id='UNIQUE_TEST_ID', name='Test Recipient list', diff --git a/examples/recipient_lists/delete_recipient_list.py b/examples/recipient_lists/delete_recipient_list.py index 094dd75..e0d17ac 100644 --- a/examples/recipient_lists/delete_recipient_list.py +++ b/examples/recipient_lists/delete_recipient_list.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() result = sp.recipient_lists.delete('list_id') print result diff --git a/examples/recipient_lists/get_recipient_list.py b/examples/recipient_lists/get_recipient_list.py index 3ad1d1b..5fa24ff 100644 --- a/examples/recipient_lists/get_recipient_list.py +++ b/examples/recipient_lists/get_recipient_list.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() recipient_list = sp.recipient_lists.get('list_id') print recipient_list diff --git a/examples/recipient_lists/get_recipient_list_with_recipients.py b/examples/recipient_lists/get_recipient_list_with_recipients.py index 1a06b57..021c8de 100644 --- a/examples/recipient_lists/get_recipient_list_with_recipients.py +++ b/examples/recipient_lists/get_recipient_list_with_recipients.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() recipient_list = sp.recipient_lists.get('list_id', True) print recipient_list diff --git a/examples/recipient_lists/list_recipient_lists.py b/examples/recipient_lists/list_recipient_lists.py index 26e4cb9..183ba0e 100644 --- a/examples/recipient_lists/list_recipient_lists.py +++ b/examples/recipient_lists/list_recipient_lists.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() recipient_lists = sp.recipient_lists.list() print recipient_lists diff --git a/examples/recipient_lists/update_recipient_list.py b/examples/recipient_lists/update_recipient_list.py index ee93e9e..4e99456 100644 --- a/examples/recipient_lists/update_recipient_list.py +++ b/examples/recipient_lists/update_recipient_list.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() response = sp.recipient_lists.update( 'EXISTING_TEST_ID', name='Test Recipient list', diff --git a/examples/suppression_list/create_suppression_entries_bulk.py b/examples/suppression_list/create_suppression_entries_bulk.py index 5dbefa9..e9fd916 100644 --- a/examples/suppression_list/create_suppression_entries_bulk.py +++ b/examples/suppression_list/create_suppression_entries_bulk.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() recipients = [ { 'email': 'test1@test.com', diff --git a/examples/suppression_list/create_suppression_entry.py b/examples/suppression_list/create_suppression_entry.py index dc5cf3a..1761980 100644 --- a/examples/suppression_list/create_suppression_entry.py +++ b/examples/suppression_list/create_suppression_entry.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() result = sp.suppression_list.create({ 'email': 'test@test.com', 'transactional': False, diff --git a/examples/suppression_list/delete_suppression_entry.py b/examples/suppression_list/delete_suppression_entry.py index 7276e21..3f0d0bb 100644 --- a/examples/suppression_list/delete_suppression_entry.py +++ b/examples/suppression_list/delete_suppression_entry.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() result = sp.suppression_list.delete('test@test.com') print result diff --git a/examples/suppression_list/get_suppression_entry.py b/examples/suppression_list/get_suppression_entry.py index 648a2f2..58a8d7b 100644 --- a/examples/suppression_list/get_suppression_entry.py +++ b/examples/suppression_list/get_suppression_entry.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() entry = sp.suppression_list.get('test@test.com') print entry diff --git a/examples/suppression_list/list_suppression_entries.py b/examples/suppression_list/list_suppression_entries.py index cf97b79..7be8360 100644 --- a/examples/suppression_list/list_suppression_entries.py +++ b/examples/suppression_list/list_suppression_entries.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() results = sp.suppression_list.list( from_date='2015-05-07T00:00:00+0000', to_date='2015-05-07T23:59:59+0000', diff --git a/examples/suppression_list/update_suppression_entries_bulk.py b/examples/suppression_list/update_suppression_entries_bulk.py index 62bfa4f..ed61449 100644 --- a/examples/suppression_list/update_suppression_entries_bulk.py +++ b/examples/suppression_list/update_suppression_entries_bulk.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() recipients = [ { 'email': 'test1@test.com', diff --git a/examples/suppression_list/update_suppression_enty.py b/examples/suppression_list/update_suppression_enty.py index 67f9b31..5f57f9a 100644 --- a/examples/suppression_list/update_suppression_enty.py +++ b/examples/suppression_list/update_suppression_enty.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() result = sp.suppression_list.update({ 'email': 'test@test.com', 'transactional': False, diff --git a/examples/templates/create_template.py b/examples/templates/create_template.py index 35fbe80..a0c5cb5 100644 --- a/examples/templates/create_template.py +++ b/examples/templates/create_template.py @@ -1,6 +1,7 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() + response = sp.templates.create( id='TEST_ID', name='Test Template', @@ -8,4 +9,5 @@ subject='Test email template!', html='This is a test email template!' ) + print response diff --git a/examples/templates/delete_template.py b/examples/templates/delete_template.py index 841ded4..e9fa281 100644 --- a/examples/templates/delete_template.py +++ b/examples/templates/delete_template.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() result = sp.templates.delete('template_id') print result diff --git a/examples/templates/get_template.py b/examples/templates/get_template.py index 6bc4a16..10d3d44 100644 --- a/examples/templates/get_template.py +++ b/examples/templates/get_template.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() template = sp.templates.get('template_id') print template diff --git a/examples/templates/list_templates.py b/examples/templates/list_templates.py index 157a536..1d46546 100644 --- a/examples/templates/list_templates.py +++ b/examples/templates/list_templates.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() template_list = sp.templates.list() print template_list diff --git a/examples/templates/preview_draft_template.py b/examples/templates/preview_draft_template.py index b78b36e..a034fc1 100644 --- a/examples/templates/preview_draft_template.py +++ b/examples/templates/preview_draft_template.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() sub_data = { 'first_name': 'John', 'last_name': 'Doe' diff --git a/examples/templates/preview_template.py b/examples/templates/preview_template.py index 2c7367d..100bcb0 100644 --- a/examples/templates/preview_template.py +++ b/examples/templates/preview_template.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() sub_data = { 'first_name': 'John', 'last_name': 'Doe' diff --git a/examples/templates/update_template.py b/examples/templates/update_template.py index 55fa801..6502b93 100644 --- a/examples/templates/update_template.py +++ b/examples/templates/update_template.py @@ -1,6 +1,6 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() response = sp.templates.update( 'TEST_ID', name='Test Template', diff --git a/examples/transmissions/find_transmission.py b/examples/transmissions/find_transmission.py index 54778ff..8053a1f 100644 --- a/examples/transmissions/find_transmission.py +++ b/examples/transmissions/find_transmission.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') -trans = sp.transmission.get('transmission_id') -print trans +sp = SparkPost() +transmission = sp.transmission.get('transmission_id') +print transmission diff --git a/examples/transmissions/get_transmissions.py b/examples/transmissions/get_transmissions.py index 14f0f41..bad61fc 100644 --- a/examples/transmissions/get_transmissions.py +++ b/examples/transmissions/get_transmissions.py @@ -1,5 +1,5 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() transmission_list = sp.transmission.list() print transmission_list diff --git a/examples/transmissions/send_transmission.py b/examples/transmissions/send_transmission.py index 2c34717..f8dec07 100644 --- a/examples/transmissions/send_transmission.py +++ b/examples/transmissions/send_transmission.py @@ -1,35 +1,35 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() response = sp.transmission.send( - recipients = [ - 'postmaster@example.com', - 'you@me.com', - { - 'address': { - 'email': 'john.doe@example.com', - 'name': 'John Doe' - } - } - ], - html = '

Hello world {{name}}

', - text = 'Hello world {{name}}', - from_email = 'test@sparkpostbox.com', - subject = 'Example Script', - description = 'contrived example', - custom_headers = { - 'X-CUSTOM-HEADER': 'foo bar' - }, - track_opens = True, - track_clicks = True, - campaign = 'sdk example', - metadata = { - 'key': 'value', - 'arbitrary': 'values' - }, - substitution_data = { - 'name': 'Example User' - }, - reply_to = 'no-reply@sparkpostmail.com' + recipients=[ + 'postmaster@example.com', + 'you@me.com', + { + 'address': { + 'email': 'john.doe@example.com', + 'name': 'John Doe' + } + } + ], + html='

Hello world {{name}}

', + text='Hello world {{name}}', + from_email='test@sparkpostbox.com', + subject='Example Script', + description='contrived example', + custom_headers={ + 'X-CUSTOM-HEADER': 'foo bar' + }, + track_opens=True, + track_clicks=True, + campaign='sdk example', + metadata={ + 'key': 'value', + 'arbitrary': 'values' + }, + substitution_data={ + 'name': 'Example User' + }, + reply_to='no-reply@sparkpostmail.com' ) diff --git a/examples/transmissions/transmission_stored_list.py b/examples/transmissions/transmission_stored_list.py index 1ad3844..4ccb4c0 100644 --- a/examples/transmissions/transmission_stored_list.py +++ b/examples/transmissions/transmission_stored_list.py @@ -1,24 +1,24 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() response = sp.transmission.send( - recipient_list = 'my_list', - html = '

Hello world {{name}}

', - text = 'Hello world {{name}}', - from_email = 'test@sparkpostbox.com', - subject = 'Example Script', - description = 'contrived example', - custom_headers = { - 'X-CUSTOM-HEADER': 'foo bar' - }, - campaign = 'sdk example', - metadata = { - 'key': 'value', - 'arbitrary': 'values' - }, - substitution_data = { - 'name': 'Example User' - }, - reply_to = 'no-reply@sparkpostmail.com' + recipient_list='my_list', + html='

Hello world {{name}}

', + text='Hello world {{name}}', + from_email='test@sparkpostbox.com', + subject='Example Script', + description='contrived example', + custom_headers={ + 'X-CUSTOM-HEADER': 'foo bar' + }, + campaign='sdk example', + metadata={ + 'key': 'value', + 'arbitrary': 'values' + }, + substitution_data={ + 'name': 'Example User' + }, + reply_to='no-reply@sparkpostmail.com' ) diff --git a/examples/transmissions/transmission_stored_template.py b/examples/transmissions/transmission_stored_template.py index 7f7f91d..fcab489 100644 --- a/examples/transmissions/transmission_stored_template.py +++ b/examples/transmissions/transmission_stored_template.py @@ -1,9 +1,9 @@ from sparkpost import SparkPost -sp = SparkPost('YOUR API KEY') +sp = SparkPost() response = sp.transmission.send( - recipients = ['you@me.com'], - template = 'my-template-id', - use_draft_template = True + recipients=['you@me.com'], + template='my-template-id', + use_draft_template=True )