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" # Authenticate via `/token` endpoint access_token = "your_access_token_here" headers = { 'Authorization': f'Bearer {access_token}', 'Accept': 'application/json' } # List your historical submissions: response = requests.get( url=f"{API_URL}/market/challenge/submission", headers=headers, timeout=30 ) # Check if the request was successful if response.status_code == 200: submissions = response.json() else: print("Failed to retrieve submissions.") print(f"Status code: {response.status_code}") exit() # Select a submission and respective challenge: selected_submission = submissions["data"][0] submission_id = selected_submission['id'] challenge_id = selected_submission['market_session_challenge'] print("Selected Submission:") print(f"Submission ID: {submission_id}") print(f"Challenge ID: {challenge_id}") # Request the submission scores for the selected challenge response = requests.get( url=f"{API_URL}/market/challenge/submission-scores", params={'challenge': challenge_id}, headers=headers, timeout=30 ) # Check if the request was successful if response.status_code == 200: submission_scores = response.json() print(submission_scores) else: print("Failed to retrieve submission scores.") print(f"Status code: {response.status_code}") exit()