Add support for downloading snapshot from doorbell - #108
Conversation
| time.sleep(delay) | ||
| response = self._ring.query(url, method="POST", json=payload, raw=1).json() | ||
| if response["timestamps"][0]["timestamp"] / 100 > request_time: | ||
| return self._ring.query(API_URI + SNAPSHOT_ENDPOINT.format(self._attrs.get('id')), raw=True).content |
There was a problem hiding this comment.
line too long (116 > 79 characters)
| request_time = time.time() | ||
| for _ in range(3): | ||
| time.sleep(delay) | ||
| response = self._ring.query(url, method="POST", json=payload, raw=1).json() |
There was a problem hiding this comment.
line too long (87 > 79 characters)
| DOORBELL_EXISTING_TYPE, DINGS_ENDPOINT, FILE_EXISTS, | ||
| LIVE_STREAMING_ENDPOINT, MSG_BOOLEAN_REQUIRED, MSG_EXISTING_TYPE, | ||
| MSG_VOL_OUTBOUND, URL_DOORBELL_HISTORY, URL_RECORDING) | ||
| MSG_VOL_OUTBOUND, SNAPSHOT_ENDPOINT, SNAPSHOT_TIMESTAMP_ENDPOINT, URL_DOORBELL_HISTORY, URL_RECORDING) |
There was a problem hiding this comment.
line too long (106 > 79 characters)
| req = self.session.put((url), params=urlencode(params)) | ||
| elif method == 'POST': | ||
| req = self.session.post((url), params=urlencode(params)) | ||
| req = self.session.post((url), params=urlencode(params), json=json) |
There was a problem hiding this comment.
line too long (87 > 79 characters)
tchellomello
left a comment
There was a problem hiding this comment.
Hello @MorganBulkeley,
Thanks for your contribution.
Could you please review the code style to make sure the tests pass?
Thank you!
| for _ in range(retries): | ||
| time.sleep(delay) | ||
| response = self._ring.query(url, method="POST", json=payload, | ||
| raw=1).json() |
There was a problem hiding this comment.
continuation line over-indented for visual indent
|
look like it doesn't work. console I have removed loop and just return content as is without |
|
UPD: about timestamps and request_time False |
|
Thanks for taking a look at this, I've been really busy these past few weeks and haven't had time to troubleshoot. |
|
JFYI: sometimes this function (not @MorganBulkeley) I am saying about ring api. working is not properly, python. ring.py be sensible of the fact that now 11:00 (AM) |
|
@odenisenko Is your ring device battery powered? It may not update the frame to save power. |
|
@MorganBulkeley is this working yet? I ran into the same error @odenisenko did. So I will also try to remove the |
last month my code is: yes, it's ugly but it works like a charm. |
|
@odenisenko Thank you! Looks like it is working. Just have to save the contents of the snapshot now! |
|
@odenisenko @MorganBulkeley Thank you both. This is working perfectly!!! |
|
Hey guys, when I do : if myring.is_connected: I'm getting the id of the last recording, but no luck with the snapshot :( any thoughts ? 6645686099222589186 Traceback (most recent call last): |
|
This is not checked into the main branch. |
|
@problemss what do u mean ? sorry :( |
this feature still not merged into the main branch,. |
|
snapshot endpoint now return 401 |
|
Good to know I am not the only one receiving this error. |
|
I'm running 0.2.3 with a ring pro and the snapshot functionality works fine in the app, but when I try to call it I'm getting this: All the other commands work fine, it's only get_snapshot that's getting an unauthorized message. |
|
Same 401 Auth error. It's because the _get_oauth_token is failing when getting the snapshot response 400 b'{"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."}\n' But postman returns just fine for the very same oath data/endpoint. So i suspect something in the session. I tried preventing session reuse without luck. |

Adds support for downloading snapshots from the doorbell
https://support.ring.com/hc/en-us/articles/360000685566-Camera-Previews-FAQ