-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow sending params in transmission list endpoint #140
Conversation
Duh! And I noticed it now that the endpoint is deprecated 🏅 |
I would modify this endpoint (you can keep the work done to date) to do a deprecation warning (docs). |
@richleland added the deprecation notice |
sparkpost/transmissions.py
Outdated
:returns: list of transmissions | ||
:raises: :exc:`SparkPostAPIException` if API call fails | ||
""" | ||
results = self.request('GET', self.uri) | ||
return results | ||
warnings.warn('deprecated', DeprecationWarning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would customize the message rather than put in deprecated. For instance we could say it will be removed from the API soon. After looking a little more, you might want to use PendingDeprecationWarning
. Curious - what does this look like at the command line for users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put a giant message initially but seemed too much. something like
This endpoint is deprecated. For details, check https://developers.sparkpost.com/api/transmissions.html#transmissions-list-get
To me it seemed verbose. But if you find this (or modify as you want) helpful, I can put that.
Also the endpoint is already deprecated; so PendingDeprecationWarning
may not be correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point on it already being deprecated, let's keep it as DeprecationWarning
. Maybe use the URL shortener for that message. Otherwise the message you suggested seems OK to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can shorten; i hope it won't feel creepy to users :).
test/test_transmissions.py
Outdated
@@ -2,6 +2,8 @@ | |||
import json | |||
import os | |||
import tempfile | |||
import warnings | |||
from mock import patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this below the external libraries. The ordering should follow this format:
- Standard library (built-in)
import
s - Standard library (built-in)
from
s
line break
- External library
import
s - External library
from
s
line break
- Local
import
s - Local
from
s
In each the imports/froms should be in alphabetical order.
sparkpost/transmissions.py
Outdated
@@ -276,7 +277,10 @@ def list(self, **kwargs): | |||
:returns: list of transmissions | |||
:raises: :exc:`SparkPostAPIException` if API call fails | |||
""" | |||
warnings.warn('deprecated', DeprecationWarning) | |||
warn_msg = 'This endpoint is deprecated. For details, ' | |||
'check http://bit.ly/2lAKj60.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have our own URL shortener: https://sparkpo.st/mklink.php
sparkpost/transmissions.py
Outdated
@@ -2,6 +2,7 @@ | |||
import copy | |||
import json | |||
import warnings | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no line break needed here - email
is in the standard lib.
eddbe00
to
7153d37
Compare
sparkpost/base.py
Outdated
@@ -37,6 +37,7 @@ def request(self, method, uri, **kwargs): | |||
'Content-Type': 'application/json', | |||
'Authorization': self.api_key | |||
} | |||
print uri, kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops!
Handles #133