Hello,
Could you please help me out a bit. Basically I'm doing a command line monitoring tool for my Axis cameras. I put a while loop in the init method, so the second instance is never created:
Could you please help me out a bit. Basically I'm doing a command line monitoring tool for my Axis cameras. I put a while loop in the init method, so the second instance is never created:
import requests
import time
class Axis:
def __init__(self, ip='192.168.0.90', username='root', password='root', reachable=True):
self.ip = ip
self.username = username
self.password = password
self.base_url = 'http://{}:{}@{}/axis-cgi/'.format(username, password, ip)
self.reachable = reachable
def getVideoStatus(self):
while True:
try:
r = requests.get('{}videostatus.cgi?status=1'.format(self.base_url))
self.reachable = True
except:
self.reachable = False
time.sleep(10)
garden = Axis('10.0.0.10', 'root', 'root')
garden.getVideoStatus()
# this never gets executed :
lobby = Axis('10.0.0.20', 'root', 'root')
lobby.getVideostatus()
