Fix jwt-token
This commit is contained in:
@@ -108,12 +108,16 @@ def send_detection(drone_type=2, drone_id=None, geo_lat=0, geo_lon=0, rssi=-45,
|
||||
)
|
||||
|
||||
if show_response:
|
||||
if response.status_code == 200:
|
||||
print(f"✅ Detection sent successfully")
|
||||
if response.status_code in [200, 201]:
|
||||
print(f"✅ Detection sent successfully (Status: {response.status_code})")
|
||||
try:
|
||||
data = response.json()
|
||||
if data.get('success'):
|
||||
print(f" Response: {data.get('message', 'OK')}")
|
||||
if 'data' in data and 'id' in data['data']:
|
||||
print(f" Detection ID: {data['data']['id']}")
|
||||
if 'data' in data and 'threat_level' in data['data']:
|
||||
print(f" Threat Level: {data['data']['threat_level']}")
|
||||
else:
|
||||
print(f" Response: {data}")
|
||||
except:
|
||||
@@ -122,7 +126,7 @@ def send_detection(drone_type=2, drone_id=None, geo_lat=0, geo_lon=0, rssi=-45,
|
||||
print(f"❌ Detection failed: {response.status_code}")
|
||||
print(f" Response: {response.text}")
|
||||
|
||||
return response.status_code == 200
|
||||
return response.status_code in [200, 201]
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
if show_response:
|
||||
|
||||
Reference in New Issue
Block a user