/pyblueiris

Async Python Library for Blue Iris JSON API

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

README

Blue Iris Python Library

An async python library for the Blue Iris JSON API.

Overview

For more in-depth documentation, visit the documentation.

Creating a BlueIris object requires you provide an async web session for it.

import pyblueiris
from aiohttp import ClientSession
import asyncio

PROTOCOL = 'http'
HOST = '192.168.1.5'
USER = 'pyserv'
PASS = 'secret-password'

async def main():  
  async with ClientSession(raise_for_status=True) as sess:
    blue = pyblueiris.BlueIris(sess, USER, PASS, PROTOCOL, HOST)
 
if __name__ == '__main__':
  asyncio.run(main())

From there you can simply call a command you want it to execute. There is a command update_all_information() which will call all data-gathering commands to fill out information about the server.

def main():  
  async with ClientSession(raise_for_status=True) as sess:
    blue = pyblueiris.BlueIris(sess, USER, PASS, PROTOCOL, HOST)
    await blue.update_all_information()

All of the information the BlueIris object knows about the server is stored in the attributes property (dictionary).

print(blue.attributes)