12 lines
473 B
Python
12 lines
473 B
Python
import urllib.request
|
|
import json
|
|
|
|
for host in ['140.44.4.36', '140.44.4.65']:
|
|
url = f"http://{host}:5380/api/user/login?user=admin&pass=snarfnetadmin"
|
|
try:
|
|
with urllib.request.urlopen(url, timeout=5) as resp:
|
|
data = json.loads(resp.read().decode('utf-8'))
|
|
print(f"{host}: status = {data.get('status')}, token = {data.get('token')}, msg = {data.get('errorMessage')}")
|
|
except Exception as e:
|
|
print(f"{host}: error = {e}")
|