SHARE
TWEET

Untitled

a guest Jan 25th, 2019 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import json
  3. from requests.auth import HTTPBasicAuth
  4.  
  5. url = 'https://api.pinnacle.com/'
  6.  
  7.  
  8. def request(api_method):
  9.     username = 'х'
  10.     password = 'х'
  11.     URL = url + api_method
  12.     headers = {
  13.     'Authorization': HTTPBasicAuth(username, password),
  14.     'Content-Type': 'application/json',
  15.     'Accept': 'application/json'
  16.     }
  17.  
  18.     r = requests.get(URL, headers)
  19.     return r.json()
  20.  
  21. print(request('v2/sports'))
  22.    
  23. {'code': 'INVALID_AUTHORIZATION_HEADER', 'message': 'HTTP Authorization header is missing'}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top