You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+29-9Lines changed: 29 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -38,29 +38,49 @@ This library was built with the intention of allowing easy communication with Bl
38
38
39
39
Usage
40
40
=========
41
-
The simplest way to use this package from a terminal is to call ``Blink.start()`` which will prompt for your Blink username and password and then log you in. Alternatively, you can instantiate the Blink class with a username and password, and call ``Blink.start()`` to login and setup without prompt, as shown below.
41
+
The simplest way to use this package from a terminal is to call ``Blink.start()`` which will prompt for your Blink username and password and then log you in. Alternatively, you can instantiate the Blink class with a username and password, and call ``Blink.start()`` to login and setup without prompt, as shown below. In addition, http requests are throttled internally via use of the ``Blink.refresh_rate`` variable, which can be set at initialization and defaults to 30 seconds.
42
42
43
43
.. code:: python
44
44
45
-
import blinkpy
46
-
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
45
+
from blinkpy import blinkpy
46
+
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD', refresh_rate=30)
47
47
blink.start()
48
48
49
49
If you would like to log in without setting up the cameras or system, you can simply call the ``Blink.login()`` function which will prompt for a username and password and then authenticate with the server. This is useful if you want to avoid use of the ``start()`` function which simply acts as a wrapper for more targeted API methods.
50
50
51
-
The cameras are of a BlinkCamera class, of which the following parameters can be used (the code below creates a Blink object and iterates through each camera found)
51
+
Cameras are instantiated as individual ``BlinkCamera`` classes within a ``BlinkSyncModule`` instance. Note: currently the API only supports one sync module, but multiple sync modules are planned to be supported in the future.
52
+
53
+
The below code will display cameras and their available attributes:
52
54
53
55
.. code:: python
54
56
55
-
import blinkpy
56
-
57
+
from blinkpy import blinkpy
58
+
57
59
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
58
60
blink.start()
59
-
60
-
for name, camera in blink.cameras.items():
61
-
print(name) # Name of the camera
61
+
62
+
for name, camera in blink.sync.cameras.items():
63
+
print(name) # Name of the camera
62
64
print(camera.attributes) # Print available attributes of camera
63
65
66
+
The most recent images and videos can be accessed as a bytes-object via internal variables. These can be updated with calls to ``Blink.refresh()`` but will only make a request if motion has been detected or other changes have been found. This can be overridden with the ``force_cache`` flag, but this should be used for debugging only since it overrides the internal request throttling.
67
+
68
+
.. code:: python
69
+
70
+
camera = blink.sync.camera['SOME CAMERA NAME']
71
+
blink.refresh(force_cache=True) # force a cache update USE WITH CAUTION
0 commit comments