Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
435f3b9831 | ||
|
|
bcf0bb5525 | ||
|
|
151d9b7375 | ||
|
|
d393c861d7 | ||
|
|
02c4b2e7e1 | ||
|
|
5e98f59cdb | ||
|
|
77649e0991 | ||
|
|
5c9ced057b | ||
|
|
7a2b3b9967 | ||
|
|
4582600900 | ||
|
|
78ec104392 | ||
|
|
f15f00e8c5 | ||
|
|
e953a2f918 | ||
|
|
9d6075c0f7 | ||
|
|
90ad0c7cc9 | ||
|
|
62a74db683 | ||
|
|
12b5dfdfd7 | ||
|
|
255812defc | ||
|
|
7b2e015eed | ||
|
|
a8605bd91f | ||
|
|
e3f9f4b0c1 | ||
|
|
ec476bb9d6 | ||
|
|
60cbcb7717 | ||
|
|
4b11a8b16a | ||
|
|
dfb90b8c86 | ||
|
|
2f0cec2724 | ||
|
|
887a1d0a2b | ||
|
|
1d65d558e8 | ||
|
|
d49a1fe36c | ||
|
|
33f0e16e7a | ||
|
|
deba0cbba6 |
@@ -0,0 +1,22 @@
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 19.10b0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
- --safe
|
||||
- --quiet
|
||||
files: ^((blinkpy|tests)/.+)?[^/]+\.py$
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.8.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies:
|
||||
- flake8-docstrings==1.5.0
|
||||
- pydocstyle==5.0.2
|
||||
files: ^(blinkpy|tests)/.+\.py$
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
|
||||
rev: v1.0.0
|
||||
hooks:
|
||||
- id: rst-linter
|
||||
files: /.+\.rst$
|
||||
+30
@@ -3,6 +3,36 @@ Changelog
|
||||
|
||||
A list of changes between each release
|
||||
|
||||
0.15.1 (2020-07-11)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Bugfix: remove "Host" from auth header (`#330 <https://github.com/fronzbot/blinkpy/pull/330>`__)
|
||||
|
||||
|
||||
0.15.0 (2020-05-08)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
**Breaking Changes:**
|
||||
|
||||
- Removed support for Python 3.5 (3.6 is now the minimum supported version)
|
||||
- Deprecated ``Blink.login()`` method. Please only use the ``Blink.start()`` method for logging in.
|
||||
|
||||
**New Functions**
|
||||
|
||||
- Add ``device_id`` override when logging in (for debug and to differentiate applications) (`#245 <https://github.com/fronzbot/blinkpy/pull/245>`__)
|
||||
|
||||
This can be used by instantiating the Blink class with the ``device_id`` parameter.
|
||||
|
||||
**All Changes:**
|
||||
|
||||
- Fix setup.py use of internal pip structure (`#233 <https://github.com/fronzbot/blinkpy/pull/233>`__)
|
||||
- Update python-slugify requirement from ~=3.0.2 to ~=4.0.0 (`#234 <https://github.com/fronzbot/blinkpy/pull/234>`__)
|
||||
- Update python-dateutil requirement from ~=2.8.0 to ~=2.8.1 (`#230 <https://github.com/fronzbot/blinkpy/pull/230>`__)
|
||||
- Bump requests from 2.22.0 to 2.23.0 (`#231 <https://github.com/fronzbot/blinkpy/pull/231>`__)
|
||||
- Refactor login logic in preparation for 2FA (`#241 <https://github.com/fronzbot/blinkpy/pull/241>`__)
|
||||
- Add 2FA Support (`#242 <https://github.com/fronzbot/blinkpy/pull/242>`__) (fixes (`#210 <https://github.com/fronzbot/blinkpy/pull/210>`__))
|
||||
- Re-set key_required and available variables after setup (`#245 <https://github.com/fronzbot/blinkpy/pull/245>`__)
|
||||
- Perform system refresh after setup (`#245 <https://github.com/fronzbot/blinkpy/pull/245>`__)
|
||||
- Fix typos (`#244 <https://github.com/fronzbot/blinkpy/pull/244>`__)
|
||||
|
||||
0.14.3 (2020-04-22)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Add time check on recorded videos before determining motion
|
||||
|
||||
+4
-7
@@ -1,6 +1,6 @@
|
||||
blinkpy |Build Status| |Coverage Status| |Docs| |PyPi Version| |Python Version| |Codestyle|
|
||||
blinkpy |Build Status| |Coverage Status| |Docs| |PyPi Version| |Codestyle|
|
||||
=============================================================================================
|
||||
A Python library for the Blink Camera system
|
||||
A Python library for the Blink Camera system (Python 3.6+)
|
||||
|
||||
Like the library? Consider buying me a cup of coffee!
|
||||
|
||||
@@ -53,7 +53,7 @@ The simplest way to use this package from a terminal is to call ``Blink.start()`
|
||||
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD', refresh_rate=30)
|
||||
blink.start()
|
||||
|
||||
At startup, you may ne prompted for a verification key. Just enter this in the command-line prompt. If you just receive a verification email asking to validate access for your device, enter nothing at this prompt. To avoid any command-line interaction, call the ``Blink`` class with the ``no_prompt=True`` flag. Instead, once you receive the verification email, call the following functions:
|
||||
At startup, you may be prompted for a verification key. Just enter this in the command-line prompt. If you just receive a verification email asking to validate access for your device, enter nothing at this prompt. To avoid any command-line interaction, call the ``Blink`` class with the ``no_prompt=True`` flag. Instead, once you receive the verification email, call the following functions:
|
||||
|
||||
.. code:: python
|
||||
|
||||
@@ -129,10 +129,7 @@ Example usage, which downloads all videos recorded since July 4th, 2018 at 9:34a
|
||||
.. |PyPi Version| image:: https://img.shields.io/pypi/v/blinkpy.svg
|
||||
:target: https://pypi.python.org/pypi/blinkpy
|
||||
.. |Docs| image:: https://readthedocs.org/projects/blinkpy/badge/?version=latest
|
||||
:target: http://blinkpy.readthedocs.io/en/latest/?badge=latest
|
||||
.. |Python Version| image:: https://img.shields.io/pypi/pyversions/blinkpy.svg
|
||||
:target: https://img.shields.io/pypi/pyversions/blinkpy.svg
|
||||
|
||||
:target: http://blinkpy.readthedocs.io/en/latest/?badge=latest
|
||||
.. |Donate| image:: https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif
|
||||
:target: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UR6Z2B8GXYUCC
|
||||
.. |Codestyle| image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
||||
|
||||
+11
-3
@@ -12,7 +12,14 @@ MIN_THROTTLE_TIME = 2
|
||||
|
||||
|
||||
def request_login(
|
||||
blink, url, username, password, notification_key, uid, is_retry=False
|
||||
blink,
|
||||
url,
|
||||
username,
|
||||
password,
|
||||
notification_key,
|
||||
uid,
|
||||
is_retry=False,
|
||||
device_id="Blinkpy",
|
||||
):
|
||||
"""
|
||||
Login request.
|
||||
@@ -22,8 +29,9 @@ def request_login(
|
||||
:param username: Blink username.
|
||||
:param password: Blink password.
|
||||
:param notification_key: Randomly genereated key.
|
||||
:param uid: Randomoly genreated unique id key.
|
||||
:param uid: Randomly generated unique id key.
|
||||
:param is_retry: Is this part of a re-authorization attempt?
|
||||
:param device_id: Name of application to send at login.
|
||||
"""
|
||||
headers = {"Host": DEFAULT_URL, "Content-Type": "application/json"}
|
||||
data = dumps(
|
||||
@@ -35,7 +43,7 @@ def request_login(
|
||||
"app_version": "6.0.7 (520300) #afb0be72a",
|
||||
"client_name": "Computer",
|
||||
"client_type": "android",
|
||||
"device_identifier": "Blinkpy",
|
||||
"device_identifier": device_id,
|
||||
"device_name": "Blinkpy",
|
||||
"os_version": "5.1.1",
|
||||
"reauth": "true",
|
||||
|
||||
+16
-7
@@ -58,6 +58,7 @@ class Blink:
|
||||
legacy_subdomain=False,
|
||||
no_prompt=False,
|
||||
persist_key=None,
|
||||
device_id="Blinkpy",
|
||||
):
|
||||
"""
|
||||
Initialize Blink system.
|
||||
@@ -71,21 +72,26 @@ class Blink:
|
||||
:param refresh_rate: Refresh rate of blink information.
|
||||
Defaults to 15 (seconds)
|
||||
:param motion_interval: How far back to register motion in minutes.
|
||||
Defaults to last refresh time.
|
||||
Useful for preventing motion_detected property
|
||||
from de-asserting too quickly.
|
||||
Defaults to last refresh time.
|
||||
Useful for preventing motion_detected property
|
||||
from de-asserting too quickly.
|
||||
:param legacy_subdomain: Set to TRUE to use old 'rest.region'
|
||||
endpoints (only use if you are having
|
||||
api issues).
|
||||
endpoints (only use if you are having
|
||||
api issues).
|
||||
:param no_prompt: Set to TRUE if using an implementation that needs to
|
||||
suppress command-line output.
|
||||
suppress command-line output.
|
||||
:param persist_key: Location of persistant identifier.
|
||||
:param device_id: Identifier for the application. Default is 'Blinkpy'.
|
||||
This is used when logging in and should be changed to
|
||||
fit the implementation (ie. "Home Assistant" in a
|
||||
Home Assistant integration).
|
||||
"""
|
||||
self.login_handler = LoginHandler(
|
||||
username=username,
|
||||
password=password,
|
||||
cred_file=cred_file,
|
||||
persist_key=persist_key,
|
||||
device_id=device_id,
|
||||
)
|
||||
self._token = None
|
||||
self._auth_header = None
|
||||
@@ -151,6 +157,8 @@ class Blink:
|
||||
sync_module.start()
|
||||
self.sync[network_name] = sync_module
|
||||
self.cameras = self.merge_cameras()
|
||||
self.available = self.refresh()
|
||||
self.key_required = False
|
||||
|
||||
def login(self):
|
||||
"""Perform server login. DEPRECATED."""
|
||||
@@ -163,6 +171,7 @@ class Blink:
|
||||
"""Retrieve the authentication token from Blink."""
|
||||
self.login_response = self.login_handler.login(self)
|
||||
if not self.login_response:
|
||||
self.available = False
|
||||
return False
|
||||
self.setup_params(self.login_response)
|
||||
if self.login_handler.check_key_required(self):
|
||||
@@ -175,7 +184,7 @@ class Blink:
|
||||
((self.region_id, self.region),) = response["region"].items()
|
||||
self._host = "{}.{}".format(self.region_id, BLINK_URL)
|
||||
self._token = response["authtoken"]["authtoken"]
|
||||
self._auth_header = {"Host": self._host, "TOKEN_AUTH": self._token}
|
||||
self._auth_header = {"TOKEN_AUTH": self._token}
|
||||
self.urls = BlinkURLHandler(self.region_id, legacy=self.legacy)
|
||||
self.networks = self.get_networks()
|
||||
self.client_id = response["client"]["id"]
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 15
|
||||
PATCH_VERSION = "0-rc.0"
|
||||
PATCH_VERSION = 1
|
||||
|
||||
__version__ = "{}.{}.{}".format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
|
||||
|
||||
|
||||
@@ -13,7 +13,14 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class LoginHandler:
|
||||
"""Class to handle login communication."""
|
||||
|
||||
def __init__(self, username=None, password=None, cred_file=None, persist_key=None):
|
||||
def __init__(
|
||||
self,
|
||||
username=None,
|
||||
password=None,
|
||||
cred_file=None,
|
||||
persist_key=None,
|
||||
device_id="Blinkpy",
|
||||
):
|
||||
"""
|
||||
Initialize login handler.
|
||||
|
||||
@@ -21,11 +28,13 @@ class LoginHandler:
|
||||
:param password: Blink password
|
||||
:param cred_file: JSON formatted credential file.
|
||||
:param persist_key: File location of persistant key.
|
||||
:param device_id: Name of application to send at login.
|
||||
"""
|
||||
self.login_url = None
|
||||
self.login_urls = const.LOGIN_URLS
|
||||
self.cred_file = cred_file
|
||||
self.persist_key = persist_key
|
||||
self.device_id = device_id
|
||||
self.data = {
|
||||
"username": username,
|
||||
"password": password,
|
||||
@@ -113,6 +122,7 @@ class LoginHandler:
|
||||
self.data["notification_key"],
|
||||
self.data["uid"],
|
||||
is_retry=False,
|
||||
device_id=self.device_id,
|
||||
)
|
||||
|
||||
if self.validate_response(url, response):
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
threshold: "2%"
|
||||
threshold: 2%
|
||||
|
||||
comment: true
|
||||
require_ci_to_pass: yes
|
||||
|
||||
@@ -2,11 +2,11 @@ black==19.10b0
|
||||
coverage==5.1
|
||||
flake8==3.7.9
|
||||
flake8-docstrings==1.5.0
|
||||
pylint==2.5.1
|
||||
pylint==2.5.2
|
||||
pydocstyle==5.0.2
|
||||
pytest==5.4.1
|
||||
pytest-cov==2.8.1
|
||||
pytest-sugar>=0.9.2
|
||||
pytest-timeout>=1.3.3
|
||||
restructuredtext-lint>=1.0.1
|
||||
pygments>=2.2.0
|
||||
pytest-sugar==0.9.3
|
||||
pytest-timeout==1.3.4
|
||||
restructuredtext-lint==1.3.0
|
||||
pygments==2.6.1
|
||||
Reference in New Issue
Block a user