hoermi

printHeaders

Aug 1st, 2022
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. -- snip --
  2. #print response.text
  3.  
  4. j = json.loads(response.text)
  5. access_token = j['access_token']
  6.  
  7. ## Call API
  8. api_endpoint = "https://s.myd.omain/rs/printHeaders.py"
  9. h = {'Authorization': 'Bearer %s' % access_token}
  10.  
  11. try:
  12. response = requests.post(api_endpoint, headers=h)
  13. except AttributeError:
  14. print ("no such attribute")
  15. except NameError:
  16. print ("no such name")
  17.  
  18. print response.text
  19.  
Advertisement
Add Comment
Please, Sign In to add comment