Add debug mode to simulate a capture

This commit is contained in:
Tanner Collin 2021-03-10 17:37:01 -07:00
parent 15023b0e24
commit ec8128d96a
3 changed files with 15 additions and 0 deletions

View File

@ -5,7 +5,17 @@ import paramiko
import time import time
paramiko.util.log_to_file('paramiko.log') paramiko.util.log_to_file('paramiko.log')
def fake_download(dest):
import requests, random
rnd = str(random.randint(1, 10000))
r = requests.get('https://picsum.photos/400/300?random=' + rnd)
with open(dest / (rnd + '.jpg'), 'wb') as f:
f.write(r.content)
def download(ip, dest): def download(ip, dest):
if settings.DEBUG:
fake_download(dest)
print('Downloading from', ip) print('Downloading from', ip)
port = 22 port = 22

View File

@ -3,6 +3,8 @@ import settings
import time import time
def np_02B_api(ip, username, password, is_on): def np_02B_api(ip, username, password, is_on):
if settings.DEBUG: return
if is_on: if is_on:
endpoint = '/cmd.cgi?grp=0' endpoint = '/cmd.cgi?grp=0'
else: else:

View File

@ -1,3 +1,6 @@
import os
DEBUG = os.environ['FLASK_ENV'] == 'development'
LIGHT_IP = '192.168.99.25' LIGHT_IP = '192.168.99.25'
LIGHT_USER = 'admin' LIGHT_USER = 'admin'
LIGHT_PASS = 'admin' LIGHT_PASS = 'admin'