Initial Checkin of REST API support
[plcapi.git] / RestClient.py
1 #!/usr/bin/python
2 import urllib2
3 import json
4
5 auth = {'AuthMethod': 'password',
6         'Username': 'USERNAME',
7         'AuthString': 'PASSWORD',
8         'Tenant': 'TENANT'}
9 req_data = json.dumps({'auth': auth})
10 req = urllib2.Request("http://0.0.0.0:8000/auth", req_data, {'Content-Type': 'application/json'})
11 f = urllib2.urlopen(req) 
12 response = f.read()
13 f.close()
14