forked from clariusdev/solum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth-request.py
More file actions
31 lines (24 loc) · 870 Bytes
/
auth-request.py
File metadata and controls
31 lines (24 loc) · 870 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
28
29
30
31
# sample script for retrieving the scanner certificates through the clarius rest api
# should be relatively simple to convert to curl, java, or other frameworks
import requests
import json
token="your_token_here"
url = "https://cloud.clarius.com/api/public/v0/devices/oem/?format=json"
hdr = {'Authorization' : 'OEM-API-Key {}'.format(token)}
# make the request
resp = requests.get(url, headers=hdr)
authenticated = []
# check for valid response
if resp.status_code == 200:
js = resp.json()
probes = js["results"]
for probe in probes:
# ensure we have a valid certificate
if "crt" in probe:
device = probe["device"]
authenticated.append({ device["serial"], probe["crt"] })
# display all authenticated probes
for auth in authenticated:
print(auth)
else:
print("error making request: ", resp)