Compare commits

...
39 Commits
Author SHA1 Message Date
Kevin FronczakandGitHub dff0a66c05 Merge pull request #472 from fronzbot/dependabot/pip/pytest-6.2.4
Bump pytest from 6.2.3 to 6.2.4
2021-06-04 07:06:57 -04:00
Kevin FronczakandGitHub 849b3e060f Merge pull request #471 from fronzbot/dependabot/pip/pygments-2.9.0
Bump pygments from 2.8.1 to 2.9.0
2021-06-04 07:06:30 -04:00
dependabot[bot]andGitHub 29c6d269a2 Bump pytest from 6.2.3 to 6.2.4
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.3 to 6.2.4.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.3...6.2.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-05 08:22:56 +00:00
dependabot[bot]andGitHub 725debaebe Bump pygments from 2.8.1 to 2.9.0
Bumps [pygments](https://github.com/pygments/pygments) from 2.8.1 to 2.9.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.8.1...2.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 08:22:45 +00:00
Kevin FronczakandGitHub 7507163422 Merge pull request #468 from fronzbot/dependabot/pip/pygments-2.8.1
Bump pygments from 2.8.0 to 2.8.1
2021-05-02 08:49:37 -04:00
Kevin FronczakandGitHub 4cb9893fd9 Merge pull request #467 from fronzbot/dependabot/pip/flake8-docstrings-1.6.0
Bump flake8-docstrings from 1.5.0 to 1.6.0
2021-05-02 08:49:19 -04:00
dependabot[bot]andGitHub 6b4fba902b Bump pygments from 2.8.0 to 2.8.1
Bumps [pygments](https://github.com/pygments/pygments) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/2.8.1/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.8.0...2.8.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-02 12:07:11 +00:00
dependabot[bot]andGitHub c1dc538627 Bump flake8-docstrings from 1.5.0 to 1.6.0
Bumps [flake8-docstrings](https://gitlab.com/pycqa/flake8-docstrings) from 1.5.0 to 1.6.0.
- [Release notes](https://gitlab.com/pycqa/flake8-docstrings/tags)
- [Changelog](https://gitlab.com/pycqa/flake8-docstrings/blob/master/HISTORY.rst)
- [Commits](https://gitlab.com/pycqa/flake8-docstrings/compare/1.5.0...1.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-02 12:07:08 +00:00
Kevin FronczakandGitHub 6f262c8522 Merge pull request #466 from fronzbot/dependabot/add-v2-config-file
Upgrade to GitHub-native Dependabot
2021-05-02 08:06:34 -04:00
Kevin FronczakandGitHub d8cf932672 Update dependabot.yml 2021-05-02 07:59:10 -04:00
Kevin FronczakandGitHub 42422b3462 Merge pull request #458 from fronzbot/dependabot/pip/flake8-3.9.1
Bump flake8 from 3.8.4 to 3.9.1
2021-05-02 07:56:13 -04:00
Kevin FronczakandGitHub c51f723133 Merge pull request #459 from fronzbot/dependabot/pip/pre-commit-2.12.1
Bump pre-commit from 2.10.1 to 2.12.1
2021-05-02 07:55:47 -04:00
dependabot-preview[bot]andGitHub 7270a1c1ee Bump flake8 from 3.8.4 to 3.9.1
Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.4 to 3.9.1.
- [Release notes](https://gitlab.com/pycqa/flake8/tags)
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.4...3.9.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-05-02 11:53:45 +00:00
dependabot-preview[bot]andGitHub 67b9fe0555 Bump pre-commit from 2.10.1 to 2.12.1
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.10.1 to 2.12.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v2.10.1...v2.12.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-05-02 11:53:43 +00:00
Kevin FronczakandGitHub 887e4288ae Merge pull request #463 from fronzbot/dependabot/pip/pylint-2.8.2
Bump pylint from 2.7.0 to 2.8.2
2021-05-02 07:52:34 -04:00
Kevin FronczakandGitHub 1c59b34ac4 Merge pull request #455 from fronzbot/dependabot/pip/pytest-6.2.3
Bump pytest from 6.2.2 to 6.2.3
2021-05-02 07:47:41 -04:00
dependabot-preview[bot]andGitHub ea2ba8dfcf Upgrade to GitHub-native Dependabot 2021-04-29 15:39:17 +00:00
dependabot-preview[bot]andGitHub 78a1b9b74d Bump pylint from 2.7.0 to 2.8.2
Bumps [pylint](https://github.com/PyCQA/pylint) from 2.7.0 to 2.8.2.
- [Release notes](https://github.com/PyCQA/pylint/releases)
- [Changelog](https://github.com/PyCQA/pylint/blob/master/ChangeLog)
- [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.7.0...v2.8.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-28 04:55:17 +00:00
dependabot-preview[bot]andGitHub b99cfc74e9 Bump pytest from 6.2.2 to 6.2.3
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.2...6.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-24 12:41:34 +00:00
Kevin FronczakandGitHub 3d6efa4b0a Merge pull request #443 from fronzbot/dependabot/pip/coverage-5.5
Bump coverage from 5.4 to 5.5
2021-04-24 08:41:18 -04:00
Kevin FronczakandGitHub b998c47ac7 Merge pull request #451 from fronzbot/dependabot/pip/pydocstyle-6.0.0
Bump pydocstyle from 5.1.1 to 6.0.0
2021-04-24 08:40:23 -04:00
dependabot-preview[bot]andGitHub fc7848f00b Bump pydocstyle from 5.1.1 to 6.0.0
Bumps [pydocstyle](https://github.com/PyCQA/pydocstyle) from 5.1.1 to 6.0.0.
- [Release notes](https://github.com/PyCQA/pydocstyle/releases)
- [Changelog](https://github.com/PyCQA/pydocstyle/blob/master/docs/release_notes.rst)
- [Commits](https://github.com/PyCQA/pydocstyle/compare/5.1.1...6.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-24 11:02:56 +00:00
dependabot-preview[bot]andGitHub 125c562df5 Bump coverage from 5.4 to 5.5
Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.4 to 5.5.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.4...coverage-5.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-24 11:02:51 +00:00
Kevin FronczakandGitHub f748147dcc Merge pull request #441 from fronzbot/dependabot/pip/pylint-2.7.0
Bump pylint from 2.6.2 to 2.7.0
2021-03-24 07:01:37 -04:00
dependabot-preview[bot]andGitHub 77c23f8109 Bump pylint from 2.6.2 to 2.7.0
Bumps [pylint](https://github.com/PyCQA/pylint) from 2.6.2 to 2.7.0.
- [Release notes](https://github.com/PyCQA/pylint/releases)
- [Changelog](https://github.com/PyCQA/pylint/blob/master/ChangeLog)
- [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.6.2...pylint-2.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-22 06:12:55 +00:00
Kevin FronczakandGitHub b98c56938f Merge pull request #440 from fronzbot/dev-bump-0.18.dev0
Dev version bump
2021-02-18 09:53:36 -05:00
Kevin Fronczak 23308cd5db Dev version bump 2021-02-18 09:48:23 -05:00
Kevin FronczakandGitHub 9d9d3aa7a3 Merge pull request #438 from fronzbot/dev-bump
Version bump
2021-02-18 09:45:35 -05:00
Kevin Fronczak 3ddfd10678 Version bump 2021-02-18 09:42:45 -05:00
Kevin FronczakandGitHub 7c75ffa815 Merge pull request #436 from fronzbot/dependabot/pip/pylint-2.6.2
Bump pylint from 2.6.0 to 2.6.2
2021-02-18 09:18:16 -05:00
Kevin FronczakandGitHub 4e4b22314a Merge pull request #437 from fronzbot/add-download-delay
Add throttling to download function
2021-02-18 09:17:58 -05:00
Kevin Fronczak 4e6b570cba Change default delay to 1s 2021-02-18 08:38:27 -05:00
Kevin Fronczak b12d9ba969 Add throttling to download function 2021-02-18 08:34:57 -05:00
dependabot-preview[bot]andGitHub 83df95f0da Bump pylint from 2.6.0 to 2.6.2
Bumps [pylint](https://github.com/PyCQA/pylint) from 2.6.0 to 2.6.2.
- [Release notes](https://github.com/PyCQA/pylint/releases)
- [Changelog](https://github.com/PyCQA/pylint/blob/master/ChangeLog)
- [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.6.0...pylint-2.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-17 06:07:15 +00:00
Kevin Fronczak 3c5caae93f Dev version bump 2021-02-15 10:31:30 -05:00
Kevin Fronczak b41460c569 Add 0.17.0 changes 2021-02-15 10:27:32 -05:00
Kevin Fronczak 9ff02de48b Version bump 2021-02-15 10:16:59 -05:00
Kevin FronczakandGitHub 14cbbacc1b Merge pull request #433 from fronzbot/dependabot/pip/pygments-2.8.0
Bump pygments from 2.7.4 to 2.8.0
2021-02-15 10:14:35 -05:00
dependabot-preview[bot]andGitHub 1cadf3488d Bump pygments from 2.7.4 to 2.8.0
Bumps [pygments](https://github.com/pygments/pygments) from 2.7.4 to 2.8.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.7.4...2.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 06:09:58 +00:00
7 changed files with 87 additions and 18 deletions
+9
View File
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
reviewers:
- fronzbot
+30
View File
@@ -4,6 +4,36 @@ Changelog
A list of changes between each release
0.17.1 (2021-02-18)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add delay parameter to Blink.download_videos method in order to throttle API during video retrieval (`#437 <https://github.com/fronzbot/blinkpy/pull/437>`__)
- Bump pylint to 2.6.2
0.17.0 (2021-02-15)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Bugfixes:**
- Fix video downloading bug (`#424 <https://github.com/fronzbot/blinkpy/pull/424>`__)
- Fix repeated authorization email bug (`#432 <https://github.com/fronzbot/blinkpy/pull/432>`__ and `#428 <https://github.com/fronzbot/blinkpy/pull/428>`__)
**New Features:**
- Add logout method (`#429 <https://github.com/fronzbot/blinkpy/pull/429>`__)
- Add camera record method (`#430 <https://github.com/fronzbot/blinkpy/pull/430>`__)
**Other:**
- Add debug script to main repo to help with general debug
- Upgrade login endpoint from v4 to v5
- Add python 3.9 support
- Bump coverage to 5.4
- Bump pytest to 6.2.2
- Bump pytest-cov to 2.11.1
- Bump pygments to 2.8.0
- Bump pre-commit to 2.10.1
- Bump restructuredtext-lint to 1.3.2
0.16.4 (2020-11-22)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+3 -3
View File
@@ -174,13 +174,13 @@ Similar methods exist for individual cameras:
Download videos
----------------
You can also use this library to download all videos from the server. In order to do this, you must specify a ``path``. You may also specifiy a how far back in time to go to retrieve videos via the ``since=`` variable (a simple string such as ``"2017/09/21"`` is sufficient), as well as how many pages to traverse via the ``stop=`` variable. Note that by default, the library will search the first ten pages which is sufficient in most use cases. Additionally, you can specify one or more cameras via the ``camera=`` property. This can be a single string indicating the name of the camera, or a list of camera names. By default, it is set to the string ``'all'`` to grab videos from all cameras.
You can also use this library to download all videos from the server. In order to do this, you must specify a ``path``. You may also specifiy a how far back in time to go to retrieve videos via the ``since=`` variable (a simple string such as ``"2017/09/21"`` is sufficient), as well as how many pages to traverse via the ``stop=`` variable. Note that by default, the library will search the first ten pages which is sufficient in most use cases. Additionally, you can specify one or more cameras via the ``camera=`` property. This can be a single string indicating the name of the camera, or a list of camera names. By default, it is set to the string ``'all'`` to grab videos from all cameras. If you are downloading many items, setting the ``delay`` parameter is advised in order to throttle sequential calls to the API. By default this is set to ``1`` but can be any integer representing the number of seconds to delay between calls.
Example usage, which downloads all videos recorded since July 4th, 2018 at 9:34am to the ``/home/blink`` directory:
Example usage, which downloads all videos recorded since July 4th, 2018 at 9:34am to the ``/home/blink`` directory with a 2s delay between calls:
.. code:: python
blink.download_videos('/home/blink', since='2018/07/04 09:34')
blink.download_videos('/home/blink', since='2018/07/04 09:34', delay=2)
.. |Build Status| image:: https://github.com/fronzbot/blinkpy/workflows/build/badge.svg
+8 -3
View File
@@ -264,7 +264,9 @@ class Blink:
"""Save login data to file."""
util.json_save(self.auth.login_attributes, file_name)
def download_videos(self, path, since=None, camera="all", stop=10, debug=False):
def download_videos(
self, path, since=None, camera="all", stop=10, delay=1, debug=False
):
"""
Download all videos from server since specified time.
@@ -275,6 +277,7 @@ class Blink:
:param camera: Camera name to retrieve. Defaults to "all".
Use a list for multiple cameras.
:param stop: Page to stop on (~25 items per page. Default page 10).
:param delay: Number of seconds to wait in between subsequent video downloads.
:param debug: Set to TRUE to prevent downloading of items.
Instead of downloading, entries will be printed to log.
"""
@@ -301,9 +304,9 @@ class Blink:
_LOGGER.info("No videos found on page %s. Exiting.", page)
break
self._parse_downloaded_items(result, camera, path, debug)
self._parse_downloaded_items(result, camera, path, delay, debug)
def _parse_downloaded_items(self, result, camera, path, debug):
def _parse_downloaded_items(self, result, camera, path, delay, debug):
"""Parse downloaded videos."""
for item in result:
try:
@@ -351,6 +354,8 @@ class Blink:
"Address: {address}, Filename: {filename}"
)
)
if delay > 0:
time.sleep(delay)
class BlinkSetupError(Exception):
+2 -2
View File
@@ -3,8 +3,8 @@
import os
MAJOR_VERSION = 0
MINOR_VERSION = 17
PATCH_VERSION = "0.rc1"
MINOR_VERSION = 18
PATCH_VERSION = "0.dev0"
__version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}"
+8 -8
View File
@@ -1,14 +1,14 @@
black==19.10b0
coverage==5.4
flake8==3.8.4
flake8-docstrings==1.5.0
pre-commit==2.10.1
pylint==2.6.0
pydocstyle==5.1.1
pytest==6.2.2
coverage==5.5
flake8==3.9.1
flake8-docstrings==1.6.0
pre-commit==2.12.1
pylint==2.8.2
pydocstyle==6.0.0
pytest==6.2.4
pytest-cov==2.11.1
pytest-sugar==0.9.4
pytest-timeout==1.4.2
restructuredtext-lint==1.3.2
pygments==2.7.4
pygments==2.9.0
testtools>=2.4.0
+27 -2
View File
@@ -2,6 +2,7 @@
import unittest
from unittest import mock
import logging
import time
from blinkpy import blinkpy
from blinkpy.sync_module import BlinkSyncModule
@@ -88,9 +89,33 @@ class TestBlinkFunctions(unittest.TestCase):
"DEBUG:blinkpy.blinkpy:foo: /bar.mp4 is marked as deleted.",
]
with self.assertLogs() as dl_log:
blink.download_videos("/tmp", stop=2)
blink.download_videos("/tmp", stop=2, delay=0)
self.assertEqual(dl_log.output, expected_log)
@mock.patch("blinkpy.blinkpy.api.request_videos")
def test_parse_downloaded_throttle(self, mock_req):
"""Test ability to parse downloaded items list."""
generic_entry = {
"created_at": "1970",
"device_name": "foo",
"deleted": False,
"media": "/bar.mp4",
}
result = [generic_entry]
mock_req.return_value = {"media": result}
self.blink.last_refresh = 0
start = time.time()
self.blink.download_videos("/tmp", stop=2, delay=0, debug=True)
now = time.time()
delta = now - start
self.assertTrue(delta < 0.1)
start = time.time()
self.blink.download_videos("/tmp", stop=2, delay=0.1, debug=True)
now = time.time()
delta = now - start
self.assertTrue(delta >= 0.1)
@mock.patch("blinkpy.blinkpy.api.request_videos")
def test_parse_camera_not_in_list(self, mock_req):
"""Test ability to parse downloaded items list."""
@@ -113,7 +138,7 @@ class TestBlinkFunctions(unittest.TestCase):
"DEBUG:blinkpy.blinkpy:Skipping videos for foo.",
]
with self.assertLogs() as dl_log:
blink.download_videos("/tmp", camera="bar", stop=2)
blink.download_videos("/tmp", camera="bar", stop=2, delay=0)
self.assertEqual(dl_log.output, expected_log)
@mock.patch("blinkpy.blinkpy.api.request_network_update")