Skip to content

Commit 5aad8ea

Browse files
authored
Merge pull request #57 from fronzbot/dev
v0.7.0
2 parents 556c28d + 74f4bd7 commit 5aad8ea

Some content is hidden

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

84 files changed

+19081
-897
lines changed

.hound.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
python:
22
enabled: true
3+
ignored_directories:
4+
- docs
35

46
fail_on_violations: true

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ matrix:
33
include:
44
- python: "3.4.2"
55
env: TOXENV=py34
6-
- python: "3.4.2"
6+
- python: "3.6"
77
env: TOXENV=lint
88
- python: "3.5"
99
env: TOXENV=py35
1010
- python: "3.6"
1111
env: TOXENV=py36
1212
- python: "3.6-dev"
1313
env: TOXENV=py36
14-
- python: "3.4.2"
14+
- python: "3.6"
1515
env: TOXENV=build
1616

1717
install: pip install -U tox coveralls

CHANGES.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ A list of changes between each release
77
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
- Fixed style errors for bumped pydocstring and pylint versions
99
- Changed Blink.cameras dictionary to be case-insensitive (fixes `#35 <https://github.com/fronzbot/blinkpy/issues/35>`_)
10+
- Changed api endpoint for video extraction (fixes `#35 <https://github.com/fronzbot/blinkpy/issues/35>`_ and `#41 <https://github.com/fronzbot/blinkpy/issues/41>`_)
11+
- Removed last_motion() function from Blink class
12+
- Refactored code for better organization
13+
- Moved some request calls out of @property methods (enables future CLI support)
14+
- Renamed get_summary() method to summary and changed to @property
15+
- Added ability to download most recent video clip
16+
- Improved camera arm/disarm handling (`@b10m <https://github.com/fronzbot/blinkpy/pull/50>`_)
17+
- Added authentication to ``login()`` function and deprecated ``setup_system()`` in favor of ``start()``
18+
- Added ``attributes`` dictionary to camera object
1019

1120
0.6.0 (2017-05-12)
1221
^^^^^^^^^^^^^^^^^^

README.rst

Lines changed: 12 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
blinkpy |Build Status| |Coverage Status| |PyPi Version|
2-
===========================================================
1+
blinkpy |Build Status| |Coverage Status| |Docs| |PyPi Version|
2+
================================================================
33
A Python library for the Blink Camera system
44
Only compatible with Python 3+
55

6-
UPDATE (Dec. 29, 2017)
7-
======================
8-
Work on this API has been halted indefinitely since Blink has seemed to cut off API access. Looks like it's time to cut losses and go with a different camera system that's more friendly to the DIY community.
9-
106
Disclaimer:
117
~~~~~~~~~~~~~~~
128
Published under the MIT license - See LICENSE file for more details.
@@ -42,105 +38,35 @@ This library was built with the intention of allowing easy communication with Bl
4238

4339
Usage
4440
=========
45-
In terms of usage, you just need to instantiate the module with a username and password
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.
4642

4743
.. code:: python
4844
4945
import blinkpy
5046
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
47+
blink.start()
5148
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.
5250

53-
If you leave out either of those parameters, you need to call the login function which will prompt for your username and password
54-
55-
.. code:: python
56-
57-
import blinkpy
58-
blink = blinkpy.Blink()
59-
blink.login()
60-
61-
62-
Once the login information is entered, you can run the `setup_system()` function which will attempt to authenticate with Blink servers using your username and password, obtain network ids, and create a list of cameras.
6351
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)
6452

6553
.. code:: python
6654
6755
import blinkpy
6856
6957
blink = blinkpy.Blink(username='YOUR USER NAME', password='YOUR PASSWORD')
70-
blink.setup_system()
58+
blink.start()
7159
7260
for name, camera in blink.cameras.items():
7361
print(name) # Name of the camera
74-
print(camera.id) # Integer id of the camera (assigned by Blink)
75-
print(camera.armed) # Whether the device is armed/disarmed (ie. detecting motion)
76-
print(camera.clip) # Link to last motion clip captured
77-
print(camera.thumbnail) # Link to current camera thumbnail
78-
print(camera.temperature) # Current camera temperature (not super accurate, but might be useful for someone)
79-
print(camera.battery) # Current battery level... I think the value ranges from 0-3, but not quite sure yet.
80-
print(camera.battery_string) # Gives battery level as a string ("OK" or "Low"). Returns "Unknown" if value is... well, unknown
81-
print(camera.notifications) # Number of unread notifications (ie. motion alerts that haven't been viewed)
82-
print(camera.motion) # Dictionary containing values for keys ['video', 'image', 'time']
83-
# which corresponds to last motion recorded, thumbnail of last motion, and timestamp of last motion
84-
85-
86-
Class Descriptions
87-
===================
88-
.. code:: python
89-
90-
class Blink()
91-
92-
* ``Blink.cameras`` Returns a dictionary of ``BlinkCamera`` objects where the key corresponds to the camera name and the value is the actual BlinkCamera object.
93-
* ``Blink.network_id`` Returns the current network id.
94-
* ``Blink.account_id`` Returns the account id.
95-
* ``Blink.events`` Returns a list of events recorded by blink. This information will contain links to any motion caught by an armed camera..
96-
* ``Blink.online`` Returns online status of sync module (True = online, False = offline).
97-
* ``Blink.last_motion()`` Finds last motion information for each camera and stores it in the ``BlinkCamera.motion`` field.
98-
* ``Blink.arm`` Set to True to arm, False to disarm. Can be used to see the status of the system as well.
99-
* ``Blink.refresh()`` Forces a refresh of all camera information.
100-
* ``Blink.get_summary()`` Returns json formatted summary of the system.
101-
* ``Blink.get_cameras()`` Finds all cameras in the system and creates ``BlinkCamera`` objects to represent them.
102-
* ``Blink.set_links()`` Gives each BlinkCamera object the links needed to find recent images and videos.
103-
* ``Blink.login()`` Prompts user for login information.
104-
* ``Blink.get_auth_token()`` Uses login information to retrieve authorization token from Blink for further communication.
105-
* ``Blink.get_ids()`` Retrieves the network_id and account_id from Blink in order to access video and image pages on their server.
106-
* ``Blink.setup_system()`` A wrapper script that calls:
107-
62+
print(camera.attributes) # Print available attributes of camera
10863
109-
.. code:: python
110-
111-
Blink.get_auth_token()
112-
Blink.get_ids()
113-
Blink.get_camers()
114-
Blink.set_links()
11564
116-
.. code:: python
117-
118-
class BlinkCamera(config, urls)
119-
120-
The ``BlinkCamera`` class expects to receive:
121-
122-
* A dictionary ``config`` that contains the camera name, device id, armed status, thumbnail url, camera temperature, camery battery level, number of notifications, and region id
123-
* A ``BlinkURLHandler`` object that contains all the links necessary for communication.
124-
125-
126-
Ultimately, this class is just a wrapper for each individual camera in order to make communication with individual cameras less clunky. The following properties/methods are availiable (in addition to the ones mentioned earlier):
127-
128-
* ``BlinkCamera.snap_picture()`` Takes an image with the camera and saves it as the new thumbnail. The ``Blink.refresh()`` method should be called after this if you want to store the new thumbnail link.
129-
* ``BlinkCamera.set_motion_detect(enable=True/False)`` Sending True to this function will enable motion detection for the camera. Setting to False will disable motion detection.
130-
* ``BlinkCamera.image_to_file(path)`` This will write the current thumbnail to the location indicated in 'path'
131-
* ``BlinkCamera.image_refresh()`` Refreshes the current thumbnail.
132-
133-
134-
.. code:: python
135-
136-
class BlinkURLHandler(region_id)
137-
138-
The ``BlinkURLHandler`` class expects to be initialized with the region id found in the ``Blink.get_auth_token()`` function. The class will then create the necessary links required for various communication.
139-
140-
.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=master
65+
.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=dev
14166
:target: https://travis-ci.org/fronzbot/blinkpy
142-
.. |Coverage Status| image:: https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=master
143-
:target: https://coveralls.io/github/fronzbot/blinkpy?branch=master
67+
.. |Coverage Status| image:: https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=dev
68+
:target: https://coveralls.io/github/fronzbot/blinkpy?branch=dev
14469
.. |PyPi Version| image:: https://img.shields.io/pypi/v/blinkpy.svg
14570
:target: https://pypi.python.org/pypi/blinkpy
146-
71+
.. |Docs| image:: https://readthedocs.org/projects/blinkpy/badge/?version=latest
72+
:target: http://blinkpy.readthedocs.io/en/latest/?badge=latest

__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

blinkpy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Init file for blinkpy."""

0 commit comments

Comments
 (0)