forked from Krautspace/doorstatus
setstatus.py: its possible now to pass a integer to main()
to perform a stresstest its possible now to pass an integer as argument to main()
This commit is contained in:
parent
868702eb8d
commit
777c320ce4
1 changed files with 10 additions and 5 deletions
|
@ -49,18 +49,23 @@ def read_argument():
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(*status):
|
||||||
|
|
||||||
HOST = 'nr18.space'
|
HOST = 'localhost'
|
||||||
PORT = 10001
|
PORT = 10001
|
||||||
BOM = byteorder
|
BOM = byteorder
|
||||||
STATUS = None
|
STATUS = None
|
||||||
RESPONSE = None
|
RESPONSE = None
|
||||||
|
|
||||||
if check_arguments(argv) == None:
|
if status:
|
||||||
STATUS = read_argument()
|
STATUS = status[0]
|
||||||
|
STATUS = bytes([STATUS])
|
||||||
|
print('Status: {}'.format(STATUS))
|
||||||
else:
|
else:
|
||||||
STATUS = check_arguments(argv)
|
if len(argv) == 1:
|
||||||
|
STATUS = read_argument()
|
||||||
|
else:
|
||||||
|
STATUS = check_arguments(argv)
|
||||||
|
|
||||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as mySocket:
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as mySocket:
|
||||||
print('Socket created')
|
print('Socket created')
|
Loading…
Reference in a new issue