56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
import requests
|
|
import json
|
|
|
|
def test_device_lookup():
|
|
device_id = 'dbgMWS3KEHE'
|
|
api_key = 'INSdG85ANwsEIru3nUttMw'
|
|
base_url = 'https://dev-api.oneskyit.com'
|
|
endpoint = f'{base_url}/v3/crud/event_device/{device_id}'
|
|
|
|
headers = {
|
|
'x-aether-api-key': api_key,
|
|
'x-no-account-id': 'Nothing to See Here',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
params = {
|
|
'view': 'enriched'
|
|
}
|
|
|
|
print(f'Testing lookup for device: {device_id}')
|
|
print(f'Endpoint: {endpoint}')
|
|
|
|
try:
|
|
response = requests.get(endpoint, headers=headers, params=params)
|
|
print(f'Status Code: {response.status_code}')
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
device_data = data.get('data', {})
|
|
|
|
print('Returned Fields (Key Values):')
|
|
important_fields = [
|
|
'account_id_random',
|
|
'app_base_url',
|
|
'code',
|
|
'name',
|
|
'event_id_random',
|
|
'event_location_id_random',
|
|
'local_file_cache_path',
|
|
'host_file_temp_path',
|
|
'recording_path',
|
|
'cfg_json'
|
|
]
|
|
|
|
for field in important_fields:
|
|
val = device_data.get(field, 'MISSING')
|
|
print(f' {field}: {val}')
|
|
else:
|
|
print(f'Error Response: {response.text}')
|
|
|
|
except Exception as e:
|
|
print(f'Request failed: {e}')
|
|
|
|
if __name__ == '__main__':
|
|
test_device_lookup()
|