Compare commits

...
17 Commits
Author SHA1 Message Date
Kevin FronczakandGitHub 8206a49dc7 Update README.rst 2017-03-06 23:39:38 -05:00
Kevin FronczakandGitHub 6ad66f0d14 Update README.rst 2017-03-06 23:36:49 -05:00
Kevin FronczakandGitHub 6399f43677 Update README.rst 2017-03-06 23:36:29 -05:00
Kevin FronczakandGitHub 3a5c85e6dd Update .travis.yml 2017-03-06 23:32:08 -05:00
Kevin FronczakandGitHub ac440d814e Added coverage badge 2017-03-06 23:29:09 -05:00
Kevin FronczakandGitHub 270f2f8de4 Create .travis.yml 2017-03-06 23:28:00 -05:00
Kevin FronczakandGitHub 8ad03fd30b Merge pull request #9 from fronzbot/patch
Fixed issue with host name in header, added test to catch this
2017-03-06 23:21:38 -05:00
Kevin Fronczak 10837e3841 Fixed issue with host name in header, added test to catch this 2017-03-06 23:20:46 -05:00
Kevin FronczakandGitHub 9b33b27463 Merge pull request #8 from fronzbot/patch
Changed to wheel and incremented minor version
2017-03-05 21:58:19 -05:00
Kevin Fronczak e0f6384dde Changed to wheel and incremented minor version 2017-03-05 21:56:52 -05:00
Kevin FronczakandGitHub 6cbfe1440a Merge pull request #7 from fronzbot/patch
Patch
2017-01-28 15:21:17 -05:00
Kevin FronczakandGitHub b68b639d57 Merge branch 'master' into patch 2017-01-28 15:21:00 -05:00
Kevin Fronczak 83dd8b0a24 Updated test_const with realistic response and fixed key error in blinkpy 2017-01-28 15:17:10 -05:00
Kevin Fronczak 96730f3879 Added a thumb dict function 2017-01-27 00:03:35 -05:00
Kevin Fronczak 50e5e8c82d Added image refresh function, increased test coverage 2017-01-26 23:43:32 -05:00
Kevin Fronczak 38df3a8f9d String cast for refresh 2017-01-26 23:28:11 -05:00
Kevin Fronczak b3f95b9231 Fixed refresh function 2017-01-26 22:19:58 -05:00
7 changed files with 109 additions and 18 deletions
+1
View File
@@ -9,3 +9,4 @@ dist/*
MANIFEST
README
.sh
build/*
+18
View File
@@ -0,0 +1,18 @@
matrix:
fast_finish: true
include:
- python: "3.4.2"
env: TOXENV=py34
- python: "3.4.2"
env: TOXENV=pep8
- python: "3.5"
env: TOXENV=py35
- python: "3.6"
env: TOXENV=py36
- python: "3.6-dev"
env: TOXENV=py36
install: pip install -U tox coveralls
language: python
script: tox
after_success: coveralls
+5 -2
View File
@@ -1,4 +1,4 @@
**blinkpy**
**blinkpy** |Build Status| |Coverage Status|
============
A Python library for the Blink Camera system
@@ -119,7 +119,10 @@ Sending True to this function will enable motion detection for the camera. Sett
**BlinkCamera.image_to_file(path)**
This will write the current thumbnail to the location indicated in 'path'
.. |Build Status| image:: https://travis-ci.org/fronzbot/blinkpy.svg?branch=master
:target: https://travis-ci.org/fronzbot/blinkpy
.. |Coverage Status| image:: https://coveralls.io/repos/github/fronzbot/blinkpy/badge.svg?branch=master
:target: https://coveralls.io/r/fronzbot/blinkpy?branch=master
+2 -4
View File
@@ -17,8 +17,6 @@ import requests
import getpass
import json
__version__ = '0.4.1'
BLINK_URL = 'immedia-semi.com'
LOGIN_URL = 'https://prod.' + BLINK_URL + '/login'
BASE_URL = 'https://prod.' + BLINK_URL
@@ -262,7 +260,7 @@ class Blink(object):
"""Gets all events on server"""
url = BASE_URL + '/events/network/' + self._NETWORKID
headers = self._AUTH_HEADER
self._EVENTS = _request(url, headers=headers, type='get')['events']
self._EVENTS = _request(url, headers=headers, type='get')['event']
return self._EVENTS
@property
@@ -378,7 +376,7 @@ class Blink(object):
response = _request(LOGIN_URL, headers=headers, data=data, type='post')
self._TOKEN = response['authtoken']['authtoken']
(self._REGION_ID, self._REGION), = response['region'].items()
self._HOST = self._REGION + '.' + BLINK_URL
self._HOST = self._REGION_ID + '.' + BLINK_URL
self._AUTH_HEADER = {'Host': self._HOST,
'TOKEN_AUTH': self._TOKEN
}
+2 -3
View File
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from blinkpy import __version__
from setuptools import setup
setup(
name = 'blinkpy',
version = __version__,
version = '0.4.4',
description = 'A Blink camera Python library',
long_description='A library that communicates with Blink cameras',
author = 'Kevin Fronczak',
@@ -13,7 +12,7 @@ setup(
license='MIT',
url = 'https://github.com/fronzbot/blinkpy',
py_modules=['blinkpy'],
install_requires=['requests'],
install_requires=['requests>=2,<3'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
+1
View File
@@ -66,6 +66,7 @@ class TestBlinkRequests(unittest.TestCase):
self.assertEqual(name, const.CAMERA_NAME)
self.assertEqual(camera.armed, const.ARMED)
self.assertEqual(camera.motion['video'], BASE_URL + const.THUMB + '.mp4')
self.assertEqual(camera.header, const.auth_header)
elif camera.id == str(const.DEVICE_ID2):
self.assertEqual(name, const.CAMERA_NAME2)
self.assertEqual(camera.armed, const.ARMED2)
+80 -9
View File
@@ -18,12 +18,16 @@ THUMB = '/url/camera/7777/clip'
THUMB2 = '/url/camera/8888/clip'
NOTIFS = 1
NOTIFS2 = 1
SYNC_ID = 1000
if ISONLINE:
ONLINE = 'online'
else:
ONLINE = 'offline'
auth_header = {'Host': REGION_ID+'.immedia-semi.com',
'TOKEN_AUTH': TOKEN
}
response = {'account': {'notifications': 1},
'devices': [{'device_type': 'camera',
@@ -63,7 +67,7 @@ response = {'account': {'notifications': 1},
{'updated_at': '2017-01-26T19:32:10+00:00',
'device_type': 'sync_module',
'notifications': 0,
'device_id': 0000,
'device_id': SYNC_ID,
'status':
'online',
'last_hb':
@@ -77,13 +81,80 @@ response = {'account': {'notifications': 1},
'error_msg': '',
'name': 'Blink',
'notifications': NOTIFS,
'status': 'ok'},
'events': [{'camera_id':DEVICE_ID,
'type':'motion',
'video_url':THUMB + '.mp4',
'created_at':'2017-01-01'},
{'camera_id':DEVICE_ID2,
'type':'None'}],
'status': 'ok'},
'event': [{'camera_name': CAMERA_NAME,
'updated_at': '2017-01-28T19:51:52+00:00',
'sync_module_id': None,
'camera': DEVICE_ID,
'type': 'motion',
'duration': None,
'status': None,
'created_at': '2017-01-28T19:51:52+00:00',
'camera_id': DEVICE_ID,
'id': 123456789,
'siren_id': None,
'account_id': ACCOUNT_ID,
'notified': True,
'siren': None,
'syncmodule': None,
'video_url': THUMB+'.mp4',
'command_id': None,
'network_id': None,
'account': ACCOUNT_ID,
'video_id': 100000001},
{'updated_at': '2017-01-28T19:51:29+00:00',
'sync_module_id': SYNC_ID,
'camera': None,
'type': 'armed',
'duration': None,
'status': None,
'created_at':
'2017-01-28T19:51:29+00:00',
'camera_id': None,
'id': 123456789,
'siren_id': None,
'account_id': ACCOUNT_ID,
'notified': False,
'siren': None,
'syncmodule': SYNC_ID,
'command_id': None,
'network_id': None,
'account': ACCOUNT_ID},
{'updated_at': '2017-01-28T19:00:12+00:00',
'sync_module_id': SYNC_ID,
'camera': None,
'type': 'disarmed',
'duration': None,
'status': None,
'created_at': '2017-01-28T19:00:12+00:00',
'camera_id': None,
'id': 123456789,
'siren_id': None,
'account_id': 2463,
'notified': False,
'siren': None,
'syncmodule': SYNC_ID,
'command_id': None,
'network_id': None,
'account': ACCOUNT_ID},
{'camera_name': CAMERA_NAME,
'updated_at': '2017-01-28T18:59:55+00:00',
'sync_module_id': None,
'camera': DEVICE_ID,
'type': 'motion',
'duration': None,
'status': None,
'created_at': '2017-01-28T18:59:55+00:00',
'camera_id': DEVICE_ID,
'id': 123456789,
'siren_id': None,
'account_id': ACCOUNT_ID,
'notified': True,
'siren': None,
'syncmodule': None,
'command_id': None,
'network_id': None,
'account': ACCOUNT_ID}],
'syncmodule':{'name':'SyncName',
'status':ONLINE}}