Add debug mode to simulate a capture
This commit is contained in:
parent
15023b0e24
commit
ec8128d96a
|
@ -5,7 +5,17 @@ import paramiko
|
|||
import time
|
||||
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):
|
||||
if settings.DEBUG:
|
||||
fake_download(dest)
|
||||
|
||||
print('Downloading from', ip)
|
||||
|
||||
port = 22
|
||||
|
|
|
@ -3,6 +3,8 @@ import settings
|
|||
import time
|
||||
|
||||
def np_02B_api(ip, username, password, is_on):
|
||||
if settings.DEBUG: return
|
||||
|
||||
if is_on:
|
||||
endpoint = '/cmd.cgi?grp=0'
|
||||
else:
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import os
|
||||
DEBUG = os.environ['FLASK_ENV'] == 'development'
|
||||
|
||||
LIGHT_IP = '192.168.99.25'
|
||||
LIGHT_USER = 'admin'
|
||||
LIGHT_PASS = 'admin'
|
||||
|
|
Loading…
Reference in New Issue
Block a user