Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6fa4aa6f75 | ||
|
|
89da167404 | ||
|
|
f2520e35fe | ||
|
|
aaaaea4dd1 | ||
|
|
ec67d97809 | ||
|
|
f6118ea4a7 | ||
|
|
d257f676ec | ||
|
|
58f4a9df57 | ||
|
|
9d91ce62d3 | ||
|
|
511ca99cba | ||
|
|
465701810b | ||
|
|
c8c0ed58df | ||
|
|
cfe3c10cec | ||
|
|
014509bd64 | ||
|
|
f5d5d34eda | ||
|
|
64c8bec614 | ||
|
|
1b765035de | ||
|
|
93f46bde6a | ||
|
|
4a09fcf06f | ||
|
|
12a2ae1326 | ||
|
|
325241d56a | ||
|
|
95664fea1f | ||
|
|
e2b43f4b06 | ||
|
|
845c8a2a40 | ||
|
|
306f8b6cb4 | ||
|
|
a704933a35 | ||
|
|
8bd09c3726 | ||
|
|
6240364067 | ||
|
|
9d37cfccd0 | ||
|
|
125efd9436 | ||
|
|
6701fd39d8 | ||
|
|
d4edf96f83 | ||
|
|
a2555a6c40 | ||
|
|
c01a6ce16b | ||
|
|
ab38afa105 | ||
|
|
ba3c2e3489 | ||
|
|
92a2cc2d9a | ||
|
|
0842739197 | ||
|
|
f09a66c083 |
+3
-2
@@ -1,5 +1,5 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 60
|
||||
daysUntilStale: 30
|
||||
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
@@ -8,7 +8,8 @@ daysUntilClose: 7
|
||||
exemptLabels:
|
||||
- Priority
|
||||
- bug
|
||||
- Help Wanted
|
||||
- help wanted
|
||||
- feature request
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: true
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.7'
|
||||
python-version: '3.8'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
@@ -10,11 +10,11 @@ jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
strategy:
|
||||
max-parallel: 3
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
platform:
|
||||
- ubuntu-latest
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
image: python
|
||||
|
||||
stages:
|
||||
- test
|
||||
|
||||
before_script:
|
||||
- curl -O https://bootstrap.pypa.io/get-pip.py
|
||||
- python get-pip.py
|
||||
- pip install tox
|
||||
|
||||
python35:
|
||||
image: python:3.5
|
||||
stage: test
|
||||
script: tox -e py35
|
||||
|
||||
python36:
|
||||
image: python:3.6
|
||||
stage: test
|
||||
script: tox -e py36
|
||||
|
||||
lint:
|
||||
image: python:3.6
|
||||
stage: test
|
||||
script: tox -e lint
|
||||
|
||||
+25
@@ -4,6 +4,31 @@ Changelog
|
||||
|
||||
A list of changes between each release
|
||||
|
||||
0.16.4 (2020-11-22)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Bugfixes:**
|
||||
|
||||
- Updated liveview endpoint (`#389 <https://github.com/fronzbot/blinkpy/pull/389>`__)
|
||||
- Fixed mini thumbnail not updating (`#388 <https://github.com/fronzbot/blinkpy/pull/388>`__)
|
||||
- Add exception catch to prevent NoneType error on refresh, added test to check behavior as well (`#401 <https://github.com/fronzbot/blinkpy/pull/401>`__)
|
||||
- Unrelated: had to add two force methods to refresh for testing purposes. Should not change normal usage.
|
||||
- Fix malformed stream url (`#395 <https://github.com/fronzbot/blinkpy/pull/395>`__)
|
||||
|
||||
**All:**
|
||||
|
||||
- Moved testtools to requirements_test.txt (`#387 <https://github.com/fronzbot/blinkpy/pull/387>`__)
|
||||
- Bumped pytest to 6.1.1
|
||||
- Bumped flake8 to 3.8.4
|
||||
- Fixed README spelling ((`#381 <https://github.com/fronzbot/blinkpy/pull/381>`__) via @rohitsud)
|
||||
- Bumped pygments to 2.7.1
|
||||
- Bumped coverage to 5.3
|
||||
- Bumped pydocstyle to 5.1.1
|
||||
- Bumped pre-commit to 2.7.1
|
||||
- Bumped pylint to 2.6.0
|
||||
- Bumped pytest-cov to 2.10.1
|
||||
|
||||
|
||||
0.16.3 (2020-08-02)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
+8
-1
@@ -58,7 +58,11 @@ class Auth:
|
||||
"""Return authorization header."""
|
||||
if self.token is None:
|
||||
return None
|
||||
return {"TOKEN_AUTH": self.token, "user-agent": DEFAULT_USER_AGENT}
|
||||
return {
|
||||
"TOKEN_AUTH": self.token,
|
||||
"user-agent": DEFAULT_USER_AGENT,
|
||||
"content-type": "application/json",
|
||||
}
|
||||
|
||||
def create_session(self, opts=None):
|
||||
"""Create a session for blink communication."""
|
||||
@@ -227,6 +231,9 @@ class Auth:
|
||||
try:
|
||||
json_resp = response.json()
|
||||
blink.available = json_resp["valid"]
|
||||
if not json_resp["valid"]:
|
||||
_LOGGER.error(f"{json_resp['message']}")
|
||||
return False
|
||||
except (KeyError, TypeError):
|
||||
_LOGGER.error("Did not receive valid response from server.")
|
||||
return False
|
||||
|
||||
+6
-5
@@ -76,21 +76,22 @@ class Blink:
|
||||
self.no_owls = no_owls
|
||||
|
||||
@util.Throttle(seconds=MIN_THROTTLE_TIME)
|
||||
def refresh(self, force=False):
|
||||
def refresh(self, force=False, force_cache=False):
|
||||
"""
|
||||
Perform a system refresh.
|
||||
|
||||
:param force: Force an update of the camera data
|
||||
:param force: Used to override throttle, resets refresh
|
||||
:param force_cache: Used to force update without overriding throttle
|
||||
"""
|
||||
if self.check_if_ok_to_update() or force:
|
||||
if self.check_if_ok_to_update() or force or force_cache:
|
||||
if not self.available:
|
||||
self.setup_post_verify()
|
||||
|
||||
self.get_homescreen()
|
||||
for sync_name, sync_module in self.sync.items():
|
||||
_LOGGER.debug("Attempting refresh of sync %s", sync_name)
|
||||
sync_module.refresh(force_cache=force)
|
||||
if not force:
|
||||
sync_module.refresh(force_cache=(force or force_cache))
|
||||
if not force_cache:
|
||||
# Prevents rapid clearing of motion detect property
|
||||
self.last_refresh = int(time.time())
|
||||
return True
|
||||
|
||||
+1
-1
@@ -266,6 +266,6 @@ class BlinkCameraMini(BlinkCamera):
|
||||
response = api.http_post(self.sync.blink, url)
|
||||
server = response["server"]
|
||||
server_split = server.split(":")
|
||||
server_split[0] = "rtsps"
|
||||
server_split[0] = "rtsps:"
|
||||
link = "".join(server_split)
|
||||
return link
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 16
|
||||
PATCH_VERSION = "4-rc0"
|
||||
PATCH_VERSION = "5.rc0"
|
||||
|
||||
__version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}"
|
||||
|
||||
@@ -34,6 +34,7 @@ PROJECT_CLASSIFIERS = [
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Topic :: Home Automation",
|
||||
]
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class BlinkSyncModule:
|
||||
for owl in self.blink.homescreen["owls"]:
|
||||
if owl["name"] == name:
|
||||
return owl
|
||||
except KeyError:
|
||||
except (TypeError, KeyError):
|
||||
pass
|
||||
return None
|
||||
|
||||
@@ -270,7 +270,7 @@ class BlinkOwl(BlinkSyncModule):
|
||||
if owl["name"] == self.name:
|
||||
self.status = owl["enabled"]
|
||||
return owl
|
||||
except KeyError:
|
||||
except (TypeError, KeyError):
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
black==19.10b0
|
||||
coverage==5.3
|
||||
coverage==5.4
|
||||
flake8==3.8.4
|
||||
flake8-docstrings==1.5.0
|
||||
pre-commit==2.7.1
|
||||
pre-commit==2.9.3
|
||||
pylint==2.6.0
|
||||
pydocstyle==5.1.1
|
||||
pytest==6.1.1
|
||||
pytest-cov==2.10.1
|
||||
pytest==6.2.2
|
||||
pytest-cov==2.11.1
|
||||
pytest-sugar==0.9.4
|
||||
pytest-timeout==1.4.2
|
||||
restructuredtext-lint==1.3.1
|
||||
pygments==2.7.1
|
||||
restructuredtext-lint==1.3.2
|
||||
pygments==2.7.4
|
||||
testtools>=2.4.0
|
||||
|
||||
+5
-1
@@ -128,7 +128,11 @@ class TestAuth(unittest.TestCase):
|
||||
def test_header(self):
|
||||
"""Test header data."""
|
||||
self.auth.token = "bar"
|
||||
expected_header = {"TOKEN_AUTH": "bar", "user-agent": const.DEFAULT_USER_AGENT}
|
||||
expected_header = {
|
||||
"TOKEN_AUTH": "bar",
|
||||
"user-agent": const.DEFAULT_USER_AGENT,
|
||||
"content-type": "application/json",
|
||||
}
|
||||
self.assertDictEqual(self.auth.header, expected_header)
|
||||
|
||||
def test_header_no_token(self):
|
||||
|
||||
@@ -5,29 +5,23 @@ import logging
|
||||
|
||||
from blinkpy import blinkpy
|
||||
from blinkpy.sync_module import BlinkSyncModule
|
||||
from blinkpy.camera import BlinkCamera
|
||||
from blinkpy.helpers.util import get_time, BlinkURLHandler
|
||||
|
||||
|
||||
class MockSyncModule(BlinkSyncModule):
|
||||
"""Mock http requests from sync module."""
|
||||
"""Mock blink sync module object."""
|
||||
|
||||
def __init__(self, blink, header):
|
||||
"""Create mock sync module instance."""
|
||||
super().__init__(blink, header, network_id=None, camera_list=None)
|
||||
self.blink = blink
|
||||
self.header = header
|
||||
self.return_value = None
|
||||
self.return_value2 = None
|
||||
def get_network_info(self):
|
||||
"""Mock network info method."""
|
||||
return True
|
||||
|
||||
def http_get(self, url, stream=False, json=True):
|
||||
"""Mock get request."""
|
||||
if stream and self.return_value2 is not None:
|
||||
return self.return_value2
|
||||
return self.return_value
|
||||
|
||||
def http_post(self, url):
|
||||
"""Mock post request."""
|
||||
return self.return_value
|
||||
class MockCamera(BlinkCamera):
|
||||
"""Mock blink camera object."""
|
||||
|
||||
def update(self, config, force_cache=False, **kwargs):
|
||||
"""Mock camera update method."""
|
||||
|
||||
|
||||
class TestBlinkFunctions(unittest.TestCase):
|
||||
@@ -121,3 +115,16 @@ class TestBlinkFunctions(unittest.TestCase):
|
||||
with self.assertLogs() as dl_log:
|
||||
blink.download_videos("/tmp", camera="bar", stop=2)
|
||||
self.assertEqual(dl_log.output, expected_log)
|
||||
|
||||
@mock.patch("blinkpy.blinkpy.api.request_network_update")
|
||||
@mock.patch("blinkpy.auth.Auth.query")
|
||||
def test_refresh(self, mock_req, mock_update):
|
||||
"""Test ability to refresh system."""
|
||||
mock_update.return_value = {"network": {"sync_module_error": False}}
|
||||
mock_req.return_value = None
|
||||
self.blink.last_refresh = 0
|
||||
self.blink.available = True
|
||||
self.blink.sync["foo"] = MockSyncModule(self.blink, "foo", 1, [])
|
||||
self.blink.cameras = {"bar": MockCamera(self.blink.sync)}
|
||||
self.blink.sync["foo"].cameras = self.blink.cameras
|
||||
self.assertTrue(self.blink.refresh())
|
||||
|
||||
@@ -69,7 +69,7 @@ class TestBlinkSetup(unittest.TestCase):
|
||||
with mock.patch(
|
||||
"blinkpy.sync_module.BlinkSyncModule.refresh", return_value=True
|
||||
), mock.patch("blinkpy.blinkpy.Blink.get_homescreen", return_value=True):
|
||||
self.blink.refresh()
|
||||
self.blink.refresh(force=True)
|
||||
|
||||
self.assertEqual(self.blink.last_refresh, now)
|
||||
self.assertEqual(self.blink.check_if_ok_to_update(), False)
|
||||
|
||||
@@ -176,3 +176,10 @@ class TestBlinkCameraSetup(unittest.TestCase):
|
||||
attr = camera.attributes
|
||||
for key in attr:
|
||||
self.assertEqual(attr[key], None)
|
||||
|
||||
def test_camera_stream(self, mock_resp):
|
||||
"""Test that camera stream returns correct url."""
|
||||
mock_resp.return_value = {"server": "rtsps://foo.bar"}
|
||||
mini_camera = BlinkCameraMini(self.blink.sync["test"])
|
||||
self.assertEqual(self.camera.get_liveview(), "rtsps://foo.bar")
|
||||
self.assertEqual(mini_camera.get_liveview(), "rtsps://foo.bar")
|
||||
|
||||
Reference in New Issue
Block a user