Advertisement
Guest User

Untitled

a guest
Apr 1st, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. '''
  2. You need to install pythin requests library for this to work
  3. e.g. pip install requests
  4. You also need to use python3
  5. '''
  6.  
  7. import requests
  8. consumer_key = input("Consumer Key --> ")
  9. username = input("Username --> ")
  10. password = input("Password --> ")
  11. url = input("Endpoint URL --> ")
  12.  
  13. authorization = 'DirectLogin username="{}", password="{}", consumer_key="{}"'.format(username, password, consumer_key)
  14.  
  15. headers={
  16. 'Accept': 'application/json',
  17. 'Authorization': authorization
  18. }
  19.  
  20. req = requests.post(url, headers=headers)
  21.  
  22. print("Your access token is:")
  23. print(req.text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement