import requests import json # Define the API URL url = "https://api.prd.video.talpa.network/graphql" # Prepare the headers headers = { "Accept": "*/*", "Accept-Language": "nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7", "Content-Type": "text/plain;charset=UTF-8", "Priority": "u=1, i", "Sec-CH-UA": "\"Google Chrome\";v=\"141\", \"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"141\"", "Sec-CH-UA-Mobile": "?0", "Sec-CH-UA-Platform": "\"Windows\"", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", } # Prepare the body of the request query = { "query": """query DrmTokenQuery($provider: DrmProvider) { drmToken(drmProvider: $provider) { expiration token } }""", "variables": { "provider": "JWP" } } # Send the POST request response = requests.post(url, headers=headers, data=json.dumps(query)) # Print the output if response.status_code == 200: # Extract the token token = response.json()['data']['drmToken']['token'] print("Token:", token) else: print("Error:", response.status_code, response.text)