43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test para verificar si departures funciona sin autenticación
|
|
"""
|
|
|
|
import requests
|
|
import json
|
|
|
|
# Test 1: departures SIN autenticación
|
|
url = "https://circulacion.api.adif.es/portroyalmanager/secure/circulationpaths/departures/traffictype/"
|
|
payload = {
|
|
"commercialService": "BOTH",
|
|
"commercialStopType": "BOTH",
|
|
"page": {"pageNumber": 0},
|
|
"stationCode": "10200",
|
|
"trafficType": "ALL"
|
|
}
|
|
|
|
headers = {
|
|
"Content-Type": "application/json;charset=utf-8",
|
|
"User-key": "f4ce9fbfa9d721e39b8984805901b5df"
|
|
}
|
|
|
|
print("="*70)
|
|
print("TEST: Departures SIN headers de autenticación HMAC")
|
|
print("="*70)
|
|
print(f"\nURL: {url}")
|
|
print(f"Payload: {json.dumps(payload, indent=2)}")
|
|
print(f"\nHeaders (solo Content-Type y User-key):")
|
|
for k, v in headers.items():
|
|
print(f" {k}: {v}")
|
|
|
|
response = requests.post(url, json=payload, headers=headers, timeout=10)
|
|
|
|
print(f"\nStatus Code: {response.status_code}")
|
|
|
|
if response.status_code == 200:
|
|
print("✅ ¡FUNCIONA SIN AUTENTICACIÓN HMAC!")
|
|
print(" Esto explica por qué departures funciona con cualquier firma.")
|
|
else:
|
|
print(f"❌ Falla: {response.status_code}")
|
|
print(f"Respuesta: {response.text[:200]}")
|