import requests URL = 'https://api.twitch.tv/helix/users/follows?to_id=642232044' authURL = 'https://id.twitch.tv/oauth2/token' Client_ID ='fkionjw34k5at27gjimfwm93xwdwnq' Secret ='8vr49dydjo446urql91h18w5eywxxn' AutParams = {'client_id': Client_ID, 'client_secret': Secret, 'grant_type': 'client_credentials' } def Check(): AutCall = requests.post(url=authURL, params=AutParams) access_token = AutCall.json()['access_token'] head = { 'Client-ID' : Client_ID, 'Authorization' : "Bearer " + access_token } r = requests.get(URL, headers = head).json()['data'] print(r) if r: r = r[0] if r['type'] == 'live': return True else: return False else: return False print(r) print(Check())