From 6362a28be4127fa86b72618999e859bbfe5d87fc Mon Sep 17 00:00:00 2001 From: Mark Cotton Date: Thu, 17 Aug 2023 10:36:13 -0500 Subject: [PATCH] working on README --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/README.md b/README.md index 4102d70..541ddee 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,64 @@ ## Summary ## This is a python package for working with the Eagle Eye Networks APIv3. It takes some liberties with the API to make it more pythonic. There is plenty of sugar sprinkled in to make it a little easier to use. +## Getting Started ## + + +Start by import the package and the config from settings (see the Settings File section below) + +``` +from EagleEyev3 import * +from settings import config +``` + +Make a new instance + +``` +een = EagleEyev3(config) +``` + + +If you are going to use the Oauth2 login flow, construct the login url + +``` +base_url = "https://auth.eagleeyenetworks.com/oauth2/authorize" +path_url = f"?client_id={een.client_id}&response_type=code&scope=vms.all&redirect_uri={een.redirect_uri}" +login_url = f"{base_url}{path_url}" } +``` + +Handle the callback from Oauth2 including the code, proceed to get access and refresh tokens + +``` +oauth_object = een.login_tokens(code) +``` + +You'll probably want to get a list of cameras + +``` +een.get_list_of_cameras() +``` + +There are helpers to get online cameras + +``` +[i for i in een.cameras if i.is_online()] +``` + +and offline + +``` +[i for i in een.cameras if i.is_offline()] +``` + +You can get a live preview image + +``` +camera.get_live_preview() +``` + + + + ## Settings File ## There is file `settings.py` that is needed to run. It should look similar to this: