Files
cariflex/scripts/check_auth.py
Eric F ffc08d0629 Initial Cariflex project
- 40 FlexMeasures assets (10 PV, 10 Bat, 10 Chg, 10 EV)
- Geolocated on Martinique
- Documentation: architecture, deployment, concepts
- Standards: Flex Ready, S2, OpenADR, EPEX SPOT
- R&D tools: HAMLET, OPLEM, lemlab
- Map patch: Mapbox -> OpenStreetMap
2026-06-07 22:19:29 -04:00

23 lines
972 B
Python

#!/usr/bin/env python3
"""Cariflex - Create assets directly via FlexMeasures API using JWT token."""
import requests, json, uuid, sys
HOST = "https://flexmeasures.digitribe.fr"
API_VERSION = "v3_0"
# Get the admin user from DB and generate a password hash
import subprocess
result = subprocess.run([
"docker", "exec", "flexmeasures-db", "psql", "-U", "flexmeasures", "-d", "flexmeasures",
"-t", "-c", "SELECT password FROM fm_user WHERE email='admin@digitribe.fr';"
], capture_output=True, text=True)
print(f"Admin password hash: {result.stdout.strip()[:50]}...")
# Try to get auth token
# First, check what auth endpoints exist
for endpoint in [f"/api/{API_VERSION}/requestAuthToken", f"/api/{API_VERSION}/auth/token", f"/api/{API_VERSION}/login"]:
r = requests.post(f"{HOST}{endpoint}",
json={"email": "admin@digitribe.fr", "password": "Digitribe972"},
verify=False, timeout=10)
print(f"{endpoint}: {r.status_code} - {r.text[:200]}")