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" access_token = "your_access_token_here" headers = { 'Authorization': f'Bearer {access_token}', 'Accept': 'application/json' } response = requests.get( url=f"{API_URL}/market/session", params={"status": "open"}, headers=headers, timeout=30 ) # Check if the request was successful if response.status_code == 200: market_sessions = response.json() print(market_sessions) else: print(f"Failed to retrieve market sessions.") print(f"Status code: {response.status_code}")