summaryrefslogtreecommitdiffstats
path: root/proxy/code/scripts/test-userapi.py
blob: 59598ddb26812929ea90b317bbf9447581083dbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python

import httplib, urllib
import sys

if len(sys.argv) < 1:
    print("please supply a message")
    sys.exit(1)

params = urllib.urlencode({'login':'candlepin', 'password':'cp_p@s$w0rd'})
headers = {"Content-type":"application/json",
           "Accept": "application/json"}
conn = httplib.HTTPConnection("localhost", 8080)
conn.request("POST", '/candlepin/user', params, headers)
response = conn.getresponse()
print response.status, response.reason
rsp = response.read()
conn.close()
print rsp

#response = urllib.urlopen('http://localhost:8080/candlepin/helloworld')
#rsp = response.read()
#print(rsp)