import requests # Predico instance URL. Switch BASE_URL to the environment you want to use: # - Playground: https://playground.predico.inesctec.pt # - Production: https://predico.inesctec.pt BASE_URL = "https://predico.inesctec.pt" API_URL = f"{BASE_URL}/api/v1" email = "your_email@example.com" password = "your_password" response = requests.post(f"{API_URL}/token", data={'email': email, 'password': password}, timeout=30) # Check if authentication was successful if response.status_code == 200: token = response.json().get('access') print(f"Access Token: {token}") else: print("Authentication failed. Please check your credentials.") print(f"Status code: {response.status_code}")