Facebook
From Sexy Plover, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 56
  1.  
  2.  
  3.  
  4. import requests
  5.  
  6.  
  7.  
  8. URL = 'https://api.twitch.tv/helix/users/follows?to_id=642232044'
  9. authURL = 'https://id.twitch.tv/oauth2/token'
  10. Client_ID ='fkionjw34k5at27gjimfwm93xwdwnq'
  11. Secret  ='8vr49dydjo446urql91h18w5eywxxn'
  12.  
  13.  
  14. AutParams = {'client_id': Client_ID,
  15.              'client_secret': Secret,
  16.              'grant_type': 'client_credentials'
  17.              }
  18.  
  19. def Check():
  20.     AutCall = requests.post(url=authURL, params=AutParams)
  21.     access_token = AutCall.json()['access_token']
  22.  
  23.     head = {
  24.     'Client-ID' : Client_ID,
  25.     'Authorization' :  "Bearer " + access_token
  26.     }
  27.  
  28.  
  29.     r = requests.get(URL, headers = head).json()['data']
  30.     print(r)
  31.  
  32.     if r:
  33.         r = r[0]
  34.         if r['type'] == 'live':
  35.             return True
  36.         else:
  37.             return False
  38.     else:
  39.         return False
  40.  
  41.     print(r)
  42.  
  43. print(Check())
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.