Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ring_doorbell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def query(self,
elif method == 'PUT':
req = self.session.put((url), params=urlencode(params))
elif method == 'POST':
req = self.session.post((url), params=urlencode(params), json=json)
req = self.session.post(
(url), params=urlencode(params), json=json)

if self.debug:
_LOGGER.debug("_query %s ret %s", loop, req.status_code)
Expand Down
8 changes: 4 additions & 4 deletions ring_doorbell/doorbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import logging
from datetime import datetime
import os
import pytz
import time
import pytz


from ring_doorbell.generic import RingGeneric
Expand Down Expand Up @@ -355,9 +355,9 @@ def get_snapshot(self, retries=3, delay=1):
request_time = time.time()
for _ in range(retries):
time.sleep(delay)
response = self._ring.query(url, method="POST", json=payload,
raw=1).json()
response = self._ring.query(
url, method="POST", json=payload, raw=1).json()
if response["timestamps"][0]["timestamp"] / 1000 > request_time:
return self._ring.query(API_URI + SNAPSHOT_ENDPOINT.format(
self._attrs.get('id')), raw=True).content
self._attrs.get('id')), raw=True).content
return False
2 changes: 1 addition & 1 deletion tests/test_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_basic_attributes(self, mock):
self.assertEqual(2, len(data.doorbells))
self.assertEqual(1, len(data.stickup_cams))
self.assertFalse(data._persist_token)
self.assertEquals('http://localhost/', data._push_token_notify_url)
self.assertEqual('http://localhost/', data._push_token_notify_url)

@requests_mock.Mocker()
def test_chime_attributes(self, mock):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ring_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def tearDown(self):

def test_locator(self):
"""Test _locator method."""
self.assertEquals(-1, _locator([DATA], 'key', 'bar'))
self.assertEquals(0, _locator([DATA], 'key', 'value'))
self.assertEqual(-1, _locator([DATA], 'key', 'bar'))
self.assertEqual(0, _locator([DATA], 'key', 'value'))

def test_initiliaze_clean_cache(self):
"""Test _clean_cache method."""
Expand Down