Guest User

Untitled

a guest
Jan 25th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  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'}
Add Comment
Please, Sign In to add comment