-
Notifications
You must be signed in to change notification settings - Fork 28
Push notifications #101
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
Push notifications #101
Conversation
@jdavid can you please take a look at the failing tests? |
Yes I will look. Actually the failure also happens in the master branch, it's unrelated to the PR. |
@jdavid Then it's probably better to solve it a separate PR, and then rebase this when the fix for tests has been merged. |
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.
Just a couple of comments.
ably/rest/push.py
Outdated
def ably(self): | ||
return self.__ably | ||
|
||
def publish(self, recipient, data): |
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'm comparing with the analogous RET publish method (https://github.com/ably/ably-python/blob/master/ably/rest/channel.py#L70)
There, we have inline doc strings - should we also do that here?
ably/rest/push.py
Outdated
|
||
body = data.copy() | ||
body.update({'recipient': recipient}) | ||
return self.ably.http.post('/push/publish', body=body) |
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.
Elsewhere there's a timeout
argument in the http post - should we also have that here?
if protocol == 'json': | ||
self.assertEquals(response.headers['content-type'], 'application/json') | ||
json.loads(response.text) | ||
if response.content: |
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.
Not a super expert in Python, but why not testing for response.text
, which is what you access in the subsequent line?
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.
Yes, I copied if response.content:
from the msgpack case, just a few lines below.
content
is the response body as a byte string, text
is the same as a text string (unicode)
I have done a different fix, and used response.json()
instead of json.loads(...)
.
DevicePushTransportType, DevicePlatform and DeviceFormFactor
I would prefer please if each set of changes had its own PR, raised against this @funkyboy can you help to set that up please? |
Okay, closing this PR. Will reset the |
See #106 |
Uh oh!
There was an error while loading. Please reload this page.