Module to handle communication with the Blink REST API
Coming once I finish the make file to generate using sphinx, should end up in github pages
Work in progress, the goal is to create an API class that only holds the REST endpoints, as well as manages the identity token for me
wrapper for the API to handle any business logic (ie. make sure network is armed before arming camera)
from shraklor.blink import BlinkRestApi
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
print(network)
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera, BlinkCameraXt, BlinkSyncModule
blink = BlinkRestApi(config['user_id'], config['password'])
devices = blink.get_devices()
for device in devices:
if isinstance(device, BlinkCameraXt):
pass
elif isinstance(device, BlinkCamera): # only print specific camera
print(device)
elif isinstance(device, BlinkSyncModule):
pass
blink = None
from shraklor.blink import BlinkRestApi
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
if not network['armed']:
blink.arm_network(network)
print('armed network {}'.format(network['name']))
blink = None
from shraklor.blink import BlinkRestApi
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
if network['armed']:
blink.disarm_network(network)
print('disarmed network {}'.format(network['name']))
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera, BlinkCameraXt, BlinkSyncModule
blink = BlinkRestApi(config['user_id'], config['password'])
devices = blink.get_devices()
for device in devices:
if isinstance(device, BlinkCameraXt):
pass
elif isinstance(device, BlinkCamera): # only print specific camera
print(device)
elif isinstance(device, BlinkSyncModule):
pass
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
devices = blink.get_network_devices(network)
for device in devices:
if not isinstance(device, BlinkCamera):
continue
camera_config = blink.get_camera_config(network['id'], device['device_id'])
if device['name'] == 'upstairs-master':
if camera_config['enabled']:
blink.disarm_camera(network, device)
else:
if not camera_config['enabled']:
blink.arm_camera(network, device)
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera, BlinkCameraXt, BlinkSyncModule
import json
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
response = blink.get_network(network)
print(json.dumps(response, indent=4, sort_keys=True))
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera, BlinkCameraXt, BlinkSyncModule
import json
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
response = blink.get_sync_modules(network)
print(json.dumps(response, indent=4, sort_keys=True))
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera, BlinkCameraXt, BlinkSyncModule
import json
blink = BlinkRestApi(config['user_id'], config['password'])
networks = blink.get_networks()
for network in networks:
response = blink.get_events(network)
print(json.dumps(response, indent=4, sort_keys=True))
blink = None
from shraklor.blink import BlinkRestApi, BlinkCamera, BlinkCameraXt, BlinkSyncModule
import json
blink = BlinkRestApi(config['user_id'], config['password'])
video_counts = blink.get_video_count()
total = video_counts['count']
page = 0
count = 0
while count < total:
videos = blink.get_videos(page)
count += len(videos)
print(json.dumps(videos, indent=4, sort_keys=True))
page += 1
print('count: {}/ page: {}'.format(count, page))
blink = None
Matt Weinecke - https://github.com/MattTW/BlinkMonitorProtocol Kevin Fronczak - https://github.com/fronzbot/blinkpy