Skip to content

Commit 0944fed

Browse files
authored
Merge pull request #830 from fronzbot/dev
0.22.4
2 parents 3d7e49a + 30dce56 commit 0944fed

23 files changed

+237
-539
lines changed

CHANGES.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ Changelog
44

55
A list of changes between each release
66

7+
0.22.4 (2023-12-18)
8+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
**Bugfixes**
11+
12+
- Allow kwargs to throttled functions, await sleep in throttle (`mkmer #823 <https://github.com/fronzbot/blinkpy/pull/800>`__)
13+
- add missing entry in type_key_map (`@Rosi2143 <https://github.com/fronzbot/blinkpy/pull/813>`__)
14+
15+
** Other Changes **
16+
17+
- Delete ReadTheDocs
18+
- python formatter
19+
- docstring format changes
20+
- Bump ruff to 0.1.8
21+
- Bump black to 23.12.0
22+
- Bump pygments to 2.17.2
23+
24+
725
0.22.3 (2023-11-05)
826
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
927

README.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
blinkpy |Build Status| |Coverage Status| |Docs| |PyPi Version| |Codestyle|
1+
blinkpy |Build Status| |Coverage Status| |PyPi Version| |Codestyle|
22
=============================================================================================
33
A Python library for the Blink Camera system (Python 3.8+)
44

@@ -39,7 +39,6 @@ To install the current development version, perform the following steps. Note t
3939
4040
If you'd like to contribute to this library, please read the `contributing instructions <https://github.com/fronzbot/blinkpy/blob/dev/CONTRIBUTING.rst>`__.
4141

42-
For more information on how to use this library, please `read the docs <https://blinkpy.readthedocs.io/en/latest/>`__.
4342

4443
Purpose
4544
-------
@@ -249,7 +248,5 @@ API steps
249248
:target: https://codecov.io/gh/fronzbot/blinkpy
250249
.. |PyPi Version| image:: https://img.shields.io/pypi/v/blinkpy.svg
251250
:target: https://pypi.python.org/pypi/blinkpy
252-
.. |Docs| image:: https://readthedocs.org/projects/blinkpy/badge/?version=latest
253-
:target: http://blinkpy.readthedocs.io/en/latest/?badge=latest
254251
.. |Codestyle| image:: https://img.shields.io/badge/code%20style-black-000000.svg
255252
:target: https://github.com/psf/black

blinkpy/api.py

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async def request_syncmodule(blink, network):
131131

132132

133133
@Throttle(seconds=MIN_THROTTLE_TIME)
134-
async def request_system_arm(blink, network):
134+
async def request_system_arm(blink, network, **kwargs):
135135
"""
136136
Arm system.
137137
@@ -148,7 +148,7 @@ async def request_system_arm(blink, network):
148148

149149

150150
@Throttle(seconds=MIN_THROTTLE_TIME)
151-
async def request_system_disarm(blink, network):
151+
async def request_system_disarm(blink, network, **kwargs):
152152
"""
153153
Disarm system.
154154
@@ -177,14 +177,14 @@ async def request_command_status(blink, network, command_id):
177177

178178

179179
@Throttle(seconds=MIN_THROTTLE_TIME)
180-
async def request_homescreen(blink):
180+
async def request_homescreen(blink, **kwargs):
181181
"""Request homescreen info."""
182182
url = f"{blink.urls.base_url}/api/v3/accounts/{blink.account_id}/homescreen"
183183
return await http_get(blink, url)
184184

185185

186186
@Throttle(seconds=MIN_THROTTLE_TIME)
187-
async def request_sync_events(blink, network):
187+
async def request_sync_events(blink, network, **kwargs):
188188
"""
189189
Request events from sync module.
190190
@@ -196,7 +196,7 @@ async def request_sync_events(blink, network):
196196

197197

198198
@Throttle(seconds=MIN_THROTTLE_TIME)
199-
async def request_new_image(blink, network, camera_id):
199+
async def request_new_image(blink, network, camera_id, **kwargs):
200200
"""
201201
Request to capture new thumbnail for camera.
202202
@@ -211,7 +211,7 @@ async def request_new_image(blink, network, camera_id):
211211

212212

213213
@Throttle(seconds=MIN_THROTTLE_TIME)
214-
async def request_new_video(blink, network, camera_id):
214+
async def request_new_video(blink, network, camera_id, **kwargs):
215215
"""
216216
Request to capture new video clip.
217217
@@ -226,7 +226,7 @@ async def request_new_video(blink, network, camera_id):
226226

227227

228228
@Throttle(seconds=MIN_THROTTLE_TIME)
229-
async def request_video_count(blink):
229+
async def request_video_count(blink, **kwargs):
230230
"""Request total video count."""
231231
url = f"{blink.urls.base_url}/api/v2/videos/count"
232232
return await http_get(blink, url)
@@ -304,14 +304,14 @@ async def request_camera_sensors(blink, network, camera_id):
304304
305305
:param blink: Blink instance.
306306
:param network: Sync module network id.
307-
:param camera_id: Camera ID of camera to request sesnor info from.
307+
:param camera_id: Camera ID of camera to request sensor info from.
308308
"""
309309
url = f"{blink.urls.base_url}/network/{network}/camera/{camera_id}/signals"
310310
return await http_get(blink, url)
311311

312312

313313
@Throttle(seconds=MIN_THROTTLE_TIME)
314-
async def request_motion_detection_enable(blink, network, camera_id):
314+
async def request_motion_detection_enable(blink, network, camera_id, **kwargs):
315315
"""
316316
Enable motion detection for a camera.
317317
@@ -326,8 +326,9 @@ async def request_motion_detection_enable(blink, network, camera_id):
326326

327327

328328
@Throttle(seconds=MIN_THROTTLE_TIME)
329-
async def request_motion_detection_disable(blink, network, camera_id):
330-
"""Disable motion detection for a camera.
329+
async def request_motion_detection_disable(blink, network, camera_id, **kwargs):
330+
"""
331+
Disable motion detection for a camera.
331332
332333
:param blink: Blink instance.
333334
:param network: Sync module network id.
@@ -340,7 +341,8 @@ async def request_motion_detection_disable(blink, network, camera_id):
340341

341342

342343
async def request_local_storage_manifest(blink, network, sync_id):
343-
"""Update local manifest.
344+
"""
345+
Update local manifest.
344346
345347
Request creation of an updated manifest of video clips stored in
346348
sync module local storage.
@@ -360,7 +362,8 @@ async def request_local_storage_manifest(blink, network, sync_id):
360362

361363

362364
async def get_local_storage_manifest(blink, network, sync_id, manifest_request_id):
363-
"""Request manifest of video clips stored in sync module local storage.
365+
"""
366+
Request manifest of video clips stored in sync module local storage.
364367
365368
:param blink: Blink instance.
366369
:param network: Sync module network id.
@@ -377,7 +380,8 @@ async def get_local_storage_manifest(blink, network, sync_id, manifest_request_i
377380

378381

379382
async def request_local_storage_clip(blink, network, sync_id, manifest_id, clip_id):
380-
"""Prepare video clip stored in the sync module to be downloaded.
383+
"""
384+
Prepare video clip stored in the sync module to be downloaded.
381385
382386
:param blink: Blink instance.
383387
:param network: Sync module network id.
@@ -400,7 +404,8 @@ async def request_local_storage_clip(blink, network, sync_id, manifest_id, clip_
400404

401405

402406
async def request_get_config(blink, network, camera_id, product_type="owl"):
403-
"""Get camera configuration.
407+
"""
408+
Get camera configuration.
404409
405410
:param blink: Blink instance.
406411
:param network: Sync module network id.
@@ -427,7 +432,8 @@ async def request_get_config(blink, network, camera_id, product_type="owl"):
427432
async def request_update_config(
428433
blink, network, camera_id, product_type="owl", data=None
429434
):
430-
"""Update camera configuration.
435+
"""
436+
Update camera configuration.
431437
432438
:param blink: Blink instance.
433439
:param network: Sync module network id.
@@ -455,7 +461,8 @@ async def request_update_config(
455461
async def http_get(
456462
blink, url, stream=False, json=True, is_retry=False, timeout=TIMEOUT
457463
):
458-
"""Perform an http get request.
464+
"""
465+
Perform an http get request.
459466
460467
:param url: URL to perform get request.
461468
:param stream: Stream response? True/FALSE
@@ -474,9 +481,10 @@ async def http_get(
474481

475482

476483
async def http_post(blink, url, is_retry=False, data=None, json=True, timeout=TIMEOUT):
477-
"""Perform an http post request.
484+
"""
485+
Perform an http post request.
478486
479-
:param url: URL to perfom post request.
487+
:param url: URL to perform post request.
480488
:param is_retry: Is this part of a re-auth attempt?
481489
:param data: str body for post request
482490
:param json: Return json response? TRUE/False

blinkpy/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, login_data=None, no_prompt=False, session=None):
2525
- username
2626
- password
2727
:param no_prompt: Should any user input prompts
28-
be supressed? True/FALSE
28+
be suppressed? True/FALSE
2929
"""
3030
if login_data is None:
3131
login_data = {}
@@ -152,8 +152,8 @@ async def query(
152152
is_retry=False,
153153
timeout=TIMEOUT,
154154
):
155-
"""Perform server requests."""
156-
"""
155+
"""Perform server requests.
156+
157157
:param url: URL to perform request
158158
:param data: Data to send
159159
:param headers: Headers to send

blinkpy/blinkpy.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
Useful for preventing motion_detected property
5959
from de-asserting too quickly.
6060
:param no_owls: Disable searching for owl entries (blink mini cameras \
61-
only known entity). Prevents an uneccessary API call \
61+
only known entity). Prevents an unnecessary API call \
6262
if you don't have these in your network.
6363
"""
6464
self.auth = Auth(session=session)
@@ -101,7 +101,7 @@ async def refresh(self, force=False, force_cache=False):
101101
# Prevents rapid clearing of motion detect property
102102
self.last_refresh = int(time.time())
103103
last_refresh = datetime.datetime.fromtimestamp(self.last_refresh)
104-
_LOGGER.debug(f"last_refresh={last_refresh}")
104+
_LOGGER.debug("last_refresh = %s", last_refresh)
105105

106106
return True
107107
return False
@@ -128,8 +128,9 @@ async def start(self):
128128
# Initialize last_refresh to be just before the refresh delay period.
129129
self.last_refresh = int(time.time() - self.refresh_rate * 1.05)
130130
_LOGGER.debug(
131-
f"Initialized last_refresh to {self.last_refresh} == "
132-
f"{datetime.datetime.fromtimestamp(self.last_refresh)}"
131+
"Initialized last_refresh to %s == %s",
132+
self.last_refresh,
133+
datetime.datetime.fromtimestamp(self.last_refresh),
133134
)
134135

135136
return await self.setup_post_verify()
@@ -167,12 +168,13 @@ async def setup_sync_module(self, name, network_id, cameras):
167168
await self.sync[name].start()
168169

169170
async def get_homescreen(self):
170-
"""Get homecreen information."""
171+
"""Get homescreen information."""
171172
if self.no_owls:
172173
_LOGGER.debug("Skipping owl extraction.")
173174
self.homescreen = {}
174175
return
175176
self.homescreen = await api.request_homescreen(self)
177+
_LOGGER.debug("homescreen = %s", util.json_dumps(self.homescreen))
176178

177179
async def setup_owls(self):
178180
"""Check for mini cameras."""
@@ -234,6 +236,7 @@ async def setup_camera_list(self):
234236
response = await api.request_camera_usage(self)
235237
try:
236238
for network in response["networks"]:
239+
_LOGGER.info("network = %s", util.json_dumps(network))
237240
camera_network = str(network["network_id"])
238241
if camera_network not in all_cameras:
239242
all_cameras[camera_network] = []

0 commit comments

Comments
 (0)