Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import requests
  2.  
  3. endpoint = "http://192.168.122.162:7000/getip"
  4. user = "testk"
  5. password = "testk"
  6. tenant = "testk"
  7. subnet = "pro"
  8. data = {'tenant': tenant, 'subnet': subnet}
  9.  
  10. r = requests.post(endpoint, auth=(user, password), data=data)
  11.  
  12. if 'data' in r.json():
  13.     print r.json()['data']['ip']
  14. else:
  15.     print r.json()['error']['message']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement