#!/usr/bin/python import urllib2 import json auth = {'AuthMethod': 'password', 'Username': 'USERNAME', 'AuthString': 'PASSWORD', 'Tenant': 'TENANT'} req_data = json.dumps({'auth': auth}) req = urllib2.Request("http://0.0.0.0:8000/auth", req_data, {'Content-Type': 'application/json'}) f = urllib2.urlopen(req) response = f.read() f.close()