Fix jwt-token

This commit is contained in:
2025-09-07 11:09:33 +02:00
parent 16eb162cc5
commit 991e601a35
4 changed files with 28 additions and 25 deletions

View File

@@ -14,7 +14,12 @@ import argparse
import os
from datetime import datetime, timedelta
# 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('/')
@@ -45,7 +50,7 @@ def fetch_devices():
"""Fetch active devices from the API"""
global DEVICES
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()
api_devices = data.get('data', [])
@@ -290,7 +295,7 @@ def send_heartbeat(device_id):
print("-"*40 + "\n")
try:
response = requests.post(url, json=heartbeat_data, headers=headers, timeout=10)
response = requests.post(url, json=heartbeat_data, headers=headers, timeout=10, verify=False)
if response.status_code == 201:
if DEBUG_MODE:
@@ -326,7 +331,7 @@ def send_detection(detection_data):
print("="*60 + "\n")
try:
response = requests.post(url, json=detection_data, headers=headers, timeout=10)
response = requests.post(url, json=detection_data, headers=headers, timeout=10, verify=False)
if response.status_code == 201:
# Estimate distance from RSSI for display purposes only
@@ -645,7 +650,7 @@ def test_api_health():
url = f"{API_BASE_URL}/health"
try:
response = requests.get(url, timeout=5)
response = requests.get(url, timeout=5, verify=False)
if response.status_code == 200:
print("✅ API health check passed")
return True