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" open_market_session_id = "your_open_market_session_id" headers = { 'Authorization': f'Bearer {access_token}', 'Accept': 'application/json' } params = { 'market_session': open_market_session_id } # Note that this request will list ALL the challenges for this specific session # you can filter these challenges by use case, resource name, etc. with the # query parameters. Check our API documentation for more information. response = requests.get( url=f"{API_URL}/market/challenge", params=params, headers=headers, timeout=30 ) # Check if the request was successful if response.status_code == 200: challenges = response.json() print("Challenges for Open Market Session:") print(challenges) else: print("Failed to retrieve challenges.") print(f"Status code: {response.status_code}")