Fix jwt-token

This commit is contained in:
2025-09-07 12:38:16 +02:00
parent 33306a5967
commit 6bbbf9855b
6 changed files with 725 additions and 4 deletions

View File

@@ -134,10 +134,12 @@ class DeviceProbeSimulator:
'key': str(device_id) # Use device_id as the key
}
print(f"📡 Sending heartbeat: {payload}")
print(f"📡 Sending heartbeat to {self.api_base_url}/detectors")
print(f" Payload: {payload}")
print(f" Headers: {dict(self.session.headers)}")
response = self.session.post(
f"{self.api_base_url}/detectors", # Updated to use detectors endpoint
f"{self.api_base_url}/detectors", # Sending to /detectors endpoint
json=payload,
verify=False,
timeout=10
@@ -146,11 +148,12 @@ class DeviceProbeSimulator:
if response.status_code in [200, 201]:
device_name = device.get('name', f'Device {device_id}')
location = device.get('location_description', 'Unknown location')
print(f"💓 Device {device_id}: Heartbeat sent successfully ({device_name} - {location})")
print(f" Device {device_id}: Heartbeat sent successfully ({device_name} - {location})")
return True
else:
print(f"❌ Failed to send heartbeat for Device {device_id}: HTTP {response.status_code}")
print(f" Response: {response.text}")
print(f" Response headers: {dict(response.headers)}")
print(f" Response body: {response.text}")
return False
except requests.exceptions.Timeout: