Skip to content

Commit 07e1759

Browse files
authored
Merge pull request #85 from fronzbot/v0.9.0
V0.9.0
2 parents 37fc047 + 8fac6c5 commit 07e1759

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1033
-18858
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ htmlcov/*
99
dist/*
1010
.sh
1111
build/*
12+
docs/_build

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
sudo: required
12
matrix:
23
fast_finish: true
34
include:
@@ -7,12 +8,11 @@ matrix:
78
env: TOXENV=py35
89
- python: "3.6"
910
env: TOXENV=py36
10-
- python: "3.6-dev"
11-
env: TOXENV=py36
1211
- python: "3.6"
1312
env: TOXENV=build
14-
- python: "3.7-dev"
13+
- python: "3.7"
1514
env: TOXENV=py37
15+
dist: xenial
1616

1717
install: pip install -U tox coveralls
1818
language: python

README.rst

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,49 @@ This library was built with the intention of allowing easy communication with Bl
3838

3939
Usage
4040
=========
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.
4242

4343
.. code:: python
4444
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)
4747
blink.start()
4848
4949
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.
5050

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:
5254

5355
.. code:: python
5456
55-
import blinkpy
56-
57+
from blinkpy import blinkpy
58+
5759
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
5860
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
6264
print(camera.attributes) # Print available attributes of camera
6365
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
72+
camera.image_from_cache.raw # bytes-like image object (jpg)
73+
camera.video_from_cache.raw # bytes-like video object (mp4)
74+
75+
The ``blinkpy`` api also allows for saving images and videos to a file and snapping a new picture from the camera remotely:
76+
77+
.. code:: python
78+
79+
camera = blink.sync.camera['SOME CAMERA NAME']
80+
camera.snap_picture() # Take a new picture with the camera
81+
blink.refresh() # Get new information from server
82+
camera.image_to_file('/local/path/for/image.jpg')
83+
camera.video_to_file('/local/path/for/video.mp4')
6484
6585
.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=dev
6686
:target: https://travis-ci.org/fronzbot/blinkpy

0 commit comments

Comments
 (0)