Guest User

Untitled

a guest
Dec 12th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. curl -i -X POST -d username=admin -d password='pass' -c ./cookies.txt http://ip_address:9080/nbapiemswsweb/login
  2. curl -v -i -H “Content-Type:application/json” -X GET -b ./cookies.txt 'http://ip_address:9080/nbapiemswsweb/rest/v1/Search/Element'
  3.  
  4. import requests
  5. from requests.auth import HTTPDigestAuth
  6. import json
  7.  
  8. url = "http://IP_ADDRESS:9080/nbapiemswsweb/login"
  9.  
  10. myResponse = requests.post(url,auth=HTTPDigestAuth(raw_input("username: "), raw_input("Password: ")), verify=True)
  11. print (myResponse.status_code)
  12.  
  13. python restapi.py
  14. username: admin
  15. Password: pass
  16. 401
Add Comment
Please, Sign In to add comment