Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae946dbb53 | ||
|
|
7ee57b2c6b | ||
|
|
ccd393a533 | ||
|
|
1b571c7d4b | ||
|
|
4b91fcb615 | ||
|
|
1e0d069dcd | ||
|
|
92088779e0 | ||
|
|
a6e02433b6 | ||
|
|
1aa5dc1c71 | ||
|
|
3c78923853 | ||
|
|
d17183a152 | ||
|
|
2e5e343913 | ||
|
|
cec6035d23 | ||
|
|
bdc760608e | ||
|
|
4f41899338 | ||
|
|
557f21b637 | ||
|
|
4241b50002 | ||
|
|
8b0507f1a7 | ||
|
|
d62429189e | ||
|
|
c83b173a17 | ||
|
|
9c1974c227 | ||
|
|
c621ba3150 | ||
|
|
7710e3f972 | ||
|
|
a4f65c1102 |
+18
-10
@@ -3,6 +3,14 @@ Changelog
|
||||
|
||||
A list of changes between each release
|
||||
|
||||
0.10.3 (2018-11-18)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Use networks endpoint rather than homecreen to retrieve arm/disarm status (`@md-reddevil <https://github.com/fronzbot/blinkpy/pull/119>`__)
|
||||
- Fix incorrect command status endpoint (`@md-reddevil <https://github.com/fronzbot/blinkpy/pull/118>`__)
|
||||
- Add extra debug logging
|
||||
- Remove error prior to re-authorization (only log error when re-auth failed)
|
||||
|
||||
|
||||
0.10.2 (2018-10-30)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Set minimum required version of the requests library to 2.20.0 due to vulnerability in earlier releases.
|
||||
@@ -11,19 +19,19 @@ A list of changes between each release
|
||||
|
||||
0.10.1 (2018-10-18)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Fix re-authorization bug (fixes `#101 <https://github.com/fronzbot/blinkpy/issues/#101>`_)
|
||||
- Fix re-authorization bug (fixes `#101 <https://github.com/fronzbot/blinkpy/issues/#101>`__)
|
||||
- Log an error if saving video that doesn't exist
|
||||
|
||||
0.10.0 (2018-10-16)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Moved all API calls to own module for easier maintainability
|
||||
- Added network ids to sync module and cameras to allow for multi-network use
|
||||
- Removed dependency on video existance prior to camera setup (fixes `#93 <https://github.com/fronzbot/blinkpy/issues/#93>`_)
|
||||
- Removed dependency on video existance prior to camera setup (fixes `#93 <https://github.com/fronzbot/blinkpy/issues/#93>`__)
|
||||
- Camera wifi_strength now reported in wifi "bars" rather than dBm due to API endpoint change
|
||||
- Use homescreen thumbnail as fallback in case it's not in the camera endpoint
|
||||
- Removed "armed" and "status" attributes from camera (status of camera only reported by "motion_enabled" now)
|
||||
- Added serial number attributes to sync module and cameras
|
||||
- Check network_id from login response and verify that network is onboarded (fixes `#90 <https://github.com/fronzbot/#90>`_)
|
||||
- Check network_id from login response and verify that network is onboarded (fixes `#90 <https://github.com/fronzbot/#90>`__)
|
||||
- Check if retrieved clip is "None" prior to storing in cache
|
||||
|
||||
0.9.0 (2018-09-27)
|
||||
@@ -55,26 +63,26 @@ A list of changes between each release
|
||||
|
||||
0.8.0 (2018-05-21)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Added support for battery voltage level (fixes `#64 <https://github.com/fronzbot/blinkpy/issues/64>`_)
|
||||
- Added support for battery voltage level (fixes `#64 <https://github.com/fronzbot/blinkpy/issues/64>`__)
|
||||
- Added motion detection per camera
|
||||
- Added fully accessible camera configuration dict
|
||||
- Added celcius property to camera (fixes `#60 <https://github.com/fronzbot/blinkpy/issues/60>`_)
|
||||
- Added celcius property to camera (fixes `#60 <https://github.com/fronzbot/blinkpy/issues/60>`__)
|
||||
|
||||
0.7.1 (2018-05-09)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Fixed pip 10 import issue during setup (`@fronzbot <https://github.com/fronzbot/blinkpy/pull/61>`_)
|
||||
- Fixed pip 10 import issue during setup (`@fronzbot <https://github.com/fronzbot/blinkpy/pull/61>`__)
|
||||
|
||||
0.7.0 (2018-02-08)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Fixed style errors for bumped pydocstring and pylint versions
|
||||
- Changed Blink.cameras dictionary to be case-insensitive (fixes `#35 <https://github.com/fronzbot/blinkpy/issues/35>`_)
|
||||
- Changed api endpoint for video extraction (fixes `#35 <https://github.com/fronzbot/blinkpy/issues/35>`_ and `#41 <https://github.com/fronzbot/blinkpy/issues/41>`_)
|
||||
- Changed Blink.cameras dictionary to be case-insensitive (fixes `#35 <https://github.com/fronzbot/blinkpy/issues/35>`__)
|
||||
- Changed api endpoint for video extraction (fixes `#35 <https://github.com/fronzbot/blinkpy/issues/35>`__ and `#41 <https://github.com/fronzbot/blinkpy/issues/41>`__)
|
||||
- Removed last_motion() function from Blink class
|
||||
- Refactored code for better organization
|
||||
- Moved some request calls out of @property methods (enables future CLI support)
|
||||
- Renamed get_summary() method to summary and changed to @property
|
||||
- Added ability to download most recent video clip
|
||||
- Improved camera arm/disarm handling (`@b10m <https://github.com/fronzbot/blinkpy/pull/50>`_)
|
||||
- Improved camera arm/disarm handling (`@b10m <https://github.com/fronzbot/blinkpy/pull/50>`__)
|
||||
- Added authentication to ``login()`` function and deprecated ``setup_system()`` in favor of ``start()``
|
||||
- Added ``attributes`` dictionary to camera object
|
||||
|
||||
@@ -83,7 +91,7 @@ A list of changes between each release
|
||||
- Removed redundent properties that only called hidden variables
|
||||
- Revised request wrapper function to be more intelligent
|
||||
- Added tests to ensure exceptions are caught and handled (100% coverage!)
|
||||
- Added auto-reauthorization (token refresh) when a request fails due to an expired token (`@tySwift93 <https://github.com/fronzbot/blinkpy/pull/24>`_)
|
||||
- Added auto-reauthorization (token refresh) when a request fails due to an expired token (`@tySwift93 <https://github.com/fronzbot/blinkpy/pull/24>`__)
|
||||
- Added battery level string to reduce confusion with the way Blink reports battery level as integer from 0 to 3
|
||||
|
||||
0.5.2 (2017-03-12)
|
||||
|
||||
+12
-4
@@ -25,11 +25,17 @@ def request_login(blink, url, username, password):
|
||||
|
||||
|
||||
def request_networks(blink):
|
||||
"""Request network information."""
|
||||
"""Request all networks information."""
|
||||
url = "{}/networks".format(blink.urls.base_url)
|
||||
return http_get(blink, url)
|
||||
|
||||
|
||||
def request_network_status(blink, network):
|
||||
"""Request network information."""
|
||||
url = "{}/network/{}".format(blink.urls.base_url, network)
|
||||
return http_get(blink, url)
|
||||
|
||||
|
||||
def request_syncmodule(blink, network):
|
||||
"""Request sync module info."""
|
||||
url = "{}/network/{}/syncmodules".format(blink.urls.base_url, network)
|
||||
@@ -50,9 +56,9 @@ def request_system_disarm(blink, network):
|
||||
|
||||
def request_command_status(blink, network, command_id):
|
||||
"""Request command status."""
|
||||
url = "{}/network/{}/command_id/{}".format(blink.urls.base_url,
|
||||
network,
|
||||
command_id)
|
||||
url = "{}/network/{}/command/{}".format(blink.urls.base_url,
|
||||
network,
|
||||
command_id)
|
||||
return http_get(blink, url)
|
||||
|
||||
|
||||
@@ -144,6 +150,7 @@ def http_get(blink, url, stream=False, json=True):
|
||||
"""
|
||||
if blink.auth_header is None:
|
||||
raise BlinkException(ERROR.AUTH_TOKEN)
|
||||
_LOGGER.debug("Making GET request to %s", url)
|
||||
return http_req(blink, url=url, headers=blink.auth_header,
|
||||
reqtype='get', stream=stream, json_resp=json)
|
||||
|
||||
@@ -156,4 +163,5 @@ def http_post(blink, url):
|
||||
"""
|
||||
if blink.auth_header is None:
|
||||
raise BlinkException(ERROR.AUTH_TOKEN)
|
||||
_LOGGER.debug("Making POST request to %s", url)
|
||||
return http_req(blink, url=url, headers=blink.auth_header, reqtype='post')
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 10
|
||||
PATCH_VERSION = 2
|
||||
PATCH_VERSION = 3
|
||||
|
||||
__version__ = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import logging
|
||||
from requests import Request, Session, exceptions
|
||||
from blinkpy.helpers.constants import BLINK_URL, PROJECT_URL
|
||||
from blinkpy.helpers.constants import BLINK_URL
|
||||
import blinkpy.helpers.errors as ERROR
|
||||
|
||||
|
||||
@@ -50,8 +50,7 @@ def http_req(blink, url='http://example.com', data=None, headers=None,
|
||||
response = blink.session.send(prepped, stream=stream)
|
||||
if json_resp and 'code' in response.json():
|
||||
if is_retry:
|
||||
_LOGGER.error(("Cannot obtain new token for server auth. "
|
||||
"Please report this issue on %s"), PROJECT_URL)
|
||||
_LOGGER.error("Cannot obtain new token for server auth.")
|
||||
return None
|
||||
else:
|
||||
headers = attempt_reauthorization(blink)
|
||||
@@ -59,13 +58,14 @@ def http_req(blink, url='http://example.com', data=None, headers=None,
|
||||
reqtype=reqtype, stream=stream,
|
||||
json_resp=json_resp, is_retry=True)
|
||||
except (exceptions.ConnectionError, exceptions.Timeout):
|
||||
_LOGGER.error("Cannot connect to server with url %s.", url)
|
||||
_LOGGER.info("Cannot connect to server with url %s.", url)
|
||||
if not is_retry:
|
||||
headers = attempt_reauthorization(blink)
|
||||
return http_req(blink, url=url, data=data, headers=headers,
|
||||
reqtype=reqtype, stream=stream,
|
||||
json_resp=json_resp, is_retry=True)
|
||||
_LOGGER.error("Possible issue with Blink servers.")
|
||||
_LOGGER.error("Endpoint %s failed. Possible issue with Blink servers.",
|
||||
url)
|
||||
return None
|
||||
|
||||
if json_resp:
|
||||
|
||||
+11
-4
@@ -31,6 +31,7 @@ class BlinkSyncModule():
|
||||
self.host = None
|
||||
self.summary = None
|
||||
self.homescreen = None
|
||||
self.network_info = None
|
||||
self.record_dates = {}
|
||||
self.videos = {}
|
||||
self.events = []
|
||||
@@ -64,7 +65,7 @@ class BlinkSyncModule():
|
||||
@property
|
||||
def arm(self):
|
||||
"""Return status of sync module: armed/disarmed."""
|
||||
return self.homescreen['network']['armed']
|
||||
return self.network_info['network']['armed']
|
||||
|
||||
@arm.setter
|
||||
def arm(self, value):
|
||||
@@ -88,6 +89,9 @@ class BlinkSyncModule():
|
||||
|
||||
self.homescreen = api.request_homescreen(self.blink)
|
||||
|
||||
self.network_info = api.request_network_status(self.blink,
|
||||
self.network_id)
|
||||
|
||||
camera_info = self.get_camera_info()
|
||||
for camera_config in camera_info:
|
||||
name = camera_config['name']
|
||||
@@ -114,6 +118,8 @@ class BlinkSyncModule():
|
||||
self.events = self.get_events()
|
||||
self.videos = self.get_videos()
|
||||
self.homescreen = api.request_homescreen(self.blink)
|
||||
self.network_info = api.request_network_status(self.blink,
|
||||
self.network_id)
|
||||
camera_info = self.get_camera_info()
|
||||
for camera_config in camera_info:
|
||||
name = camera_config['name']
|
||||
@@ -135,9 +141,10 @@ class BlinkSyncModule():
|
||||
if not this_page:
|
||||
break
|
||||
videos.append(this_page)
|
||||
|
||||
_LOGGER.debug("Getting videos from page %s through %s",
|
||||
start_page,
|
||||
end_page)
|
||||
for page in videos:
|
||||
_LOGGER.debug("Retrieved video page %s", page)
|
||||
for entry in page:
|
||||
camera_name = entry['camera_name']
|
||||
clip_addr = entry['address']
|
||||
@@ -168,5 +175,5 @@ class BlinkSyncModule():
|
||||
}
|
||||
]
|
||||
self.record_dates = all_dates
|
||||
|
||||
_LOGGER.debug("Retrieved a total of %s records", len(all_dates))
|
||||
return self.videos
|
||||
|
||||
+5
-4
@@ -25,13 +25,14 @@ class TestBlinkAPI(unittest.TestCase):
|
||||
def test_http_req_connect_error(self, mock_auth):
|
||||
"""Test http_get error condition."""
|
||||
mock_auth.return_value = {'foo': 'bar'}
|
||||
firstlog = ("ERROR:blinkpy.helpers.util:"
|
||||
"Cannot connect to server with url {}").format(
|
||||
'http://notreal.fake.')
|
||||
firstlog = ("INFO:blinkpy.helpers.util:"
|
||||
"Cannot connect to server with url {}.").format(
|
||||
'http://notreal.fake')
|
||||
nextlog = ("INFO:blinkpy.helpers.util:"
|
||||
"Auth token expired, attempting reauthorization.")
|
||||
lastlog = ("ERROR:blinkpy.helpers.util:"
|
||||
"Possible issue with Blink servers.")
|
||||
"Endpoint {} failed. Possible issue with "
|
||||
"Blink servers.").format('http://notreal.fake')
|
||||
expected = [firstlog, nextlog, firstlog, lastlog]
|
||||
with self.assertLogs() as getlog:
|
||||
api.http_get(self.blink, 'http://notreal.fake')
|
||||
|
||||
@@ -14,7 +14,6 @@ from blinkpy.sync_module import BlinkSyncModule
|
||||
from blinkpy.helpers.util import (
|
||||
http_req, create_session, BlinkAuthenticationException,
|
||||
BlinkException, BlinkURLHandler)
|
||||
from blinkpy.helpers.constants import PROJECT_URL
|
||||
import tests.mock_responses as mresp
|
||||
|
||||
USERNAME = 'foobar'
|
||||
@@ -79,8 +78,7 @@ class TestBlinkSetup(unittest.TestCase):
|
||||
"""Check that we raise an Exception with a bad request."""
|
||||
self.blink.session = create_session()
|
||||
explog = ("ERROR:blinkpy.helpers.util:"
|
||||
"Cannot obtain new token for server auth. "
|
||||
"Please report this issue on {}").format(PROJECT_URL)
|
||||
"Cannot obtain new token for server auth.")
|
||||
with self.assertRaises(BlinkException):
|
||||
http_req(self.blink, reqtype='bad')
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ class TestBlinkSyncModule(unittest.TestCase):
|
||||
'status': 'foobar'}},
|
||||
{'event': True},
|
||||
{},
|
||||
{},
|
||||
{'devicestatus': {}},
|
||||
None,
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user