-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (22 loc) · 707 Bytes
/
test.py
File metadata and controls
27 lines (22 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from client import Client
import os
import sys
import getopt
fs_url, current_firmware_version = ('', '')
try:
argumentList = sys.argv[1:]
opts, _ = getopt.getopt(argumentList, 'u:f:')
opts = dict(opts)
fs_url, current_firmware_version = opts['-u'], opts['-f']
except Exception as e:
print(e)
if not fs_url:
fs_url = 'http://127.0.0.1:80/'
if not current_firmware_version:
current_firmware_version = '1.0.2'
clt = Client(file_server_url=fs_url)
new_firmware = clt.check_new_firmware_version(current_firmware_version, download=True)
if os.sep in new_firmware.lower(): # file downloaded
print(f'New downloaded firmware path: {new_firmware}')
else:
print(new_firmware)