From 834d464add3716ffa279783f01c181e455595e2e Mon Sep 17 00:00:00 2001 From: Mark Cotton Date: Mon, 29 May 2023 22:31:56 -0500 Subject: [PATCH] added a Jupyter Notebook --- .gitignore | 3 +- Playground.ipynb | 150 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 Playground.ipynb diff --git a/.gitignore b/.gitignore index 4621e30..425a934 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ __pycache__ *.pyc .DS_Store -EagleEyev3/settings.py my_settings.py *.orig .lazy_login +.ipynb_checkpoints/ +.ipynb_checkpoints/* diff --git a/Playground.ipynb b/Playground.ipynb new file mode 100644 index 0000000..d23039a --- /dev/null +++ b/Playground.ipynb @@ -0,0 +1,150 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d4582341", + "metadata": {}, + "source": [ + "# EagleEyev3 Playground #\n", + "\n", + "To make this playground work, it is easier to read the `access_token` off the filesystem but you can always run the example server 'python server.py` to go thorugh the Oauth2 flow. By default it will save the `access_token` into a file named `.lazy_login`. The module looks for that file and tries reading t" + ] + }, + { + "cell_type": "markdown", + "id": "51b8b66e", + "metadata": {}, + "source": [ + "## Adjust Log Level" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "06d91db2", + "metadata": {}, + "outputs": [], + "source": [ + "import logging\n", + "logger = logging.getLogger()\n", + "logger.setLevel('WARN')" + ] + }, + { + "cell_type": "markdown", + "id": "8355d241", + "metadata": {}, + "source": [ + "## Import Module" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "1394471a", + "metadata": {}, + "outputs": [], + "source": [ + "from EagleEyev3 import EagleEyev3" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "486a2537", + "metadata": {}, + "outputs": [], + "source": [ + "een = EagleEyev3()" + ] + }, + { + "cell_type": "markdown", + "id": "a22ff6c2", + "metadata": {}, + "source": [ + "## Get Cameras" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "bb457850", + "metadata": {}, + "outputs": [], + "source": [ + "ret = een.get_list_of_cameras()" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "c43f1db1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[✅ [1001423e] - ATM & Wine,\n", + " ✅ [100d8666] - Cash Register,\n", + " ✅ [10012735] - Fuel Dock,\n", + " ✅ [1002584c] - Safe]" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[i for i in een.cameras if i.is_online()]" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "f4c6fe67", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[? [10090759] - Benny Camera,\n", + " ❌ [1003e10b] - Driveway,\n", + " ❌ [100ba388] - Front Door,\n", + " ? [100b7b3b] - Max Camera,\n", + " ❌ [1009ae55] - Office]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[i for i in een.cameras if not i.is_online()]" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}