Fix jwt-token
This commit is contained in:
@@ -12,7 +12,12 @@ import math
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
# Disable SSL warnings for self-signed certificates
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore', message='Unverified HTTPS request')
|
||||
|
||||
# Configuration from environment variables
|
||||
# Tests default to localhost:3002 for local development
|
||||
API_BASE_URL = os.getenv('API_BASE_URL', 'http://localhost:3002/api')
|
||||
BASE_PATH = os.getenv('VITE_BASE_PATH', '').rstrip('/')
|
||||
|
||||
@@ -42,7 +47,7 @@ def authenticate():
|
||||
|
||||
try:
|
||||
print(f"🔐 Authenticating as user: {USERNAME}")
|
||||
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data)
|
||||
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data, verify=False)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
@@ -100,7 +105,7 @@ def rssi_from_distance(distance_km):
|
||||
def fetch_devices():
|
||||
"""Fetch devices from API"""
|
||||
try:
|
||||
response = requests.get(f"{API_BASE_URL}/devices/map")
|
||||
response = requests.get(f"{API_BASE_URL}/devices/map", verify=False)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return data.get('data', [])
|
||||
@@ -125,7 +130,7 @@ def send_detection(device, drone_lat, drone_lon, distance_km, step, total_steps)
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(f"{API_BASE_URL}/detections", json=detection_data)
|
||||
response = requests.post(f"{API_BASE_URL}/detections", json=detection_data, verify=False)
|
||||
if response.status_code == 201:
|
||||
print(f"🚨 ORLAN DETECTION {step}/{total_steps}: Distance={distance_km:.2f}km, RSSI={rssi:.0f}dBm")
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user