diff options
author | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-15 18:01:57 -0400 |
---|---|---|
committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-15 18:01:57 -0400 |
commit | 3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb (patch) | |
tree | b200cd753ebb56e0cb4a0d2ef95c75d7aa97e3c9 /proxy/code/scripts/test-entitlementapi.py | |
parent | 43f60b368c5402ae98fa80620d76356f24995b3f (diff) | |
download | candlepin-3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb.tar.gz candlepin-3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb.tar.xz candlepin-3e780ad6ebb06ff3ef09df54a3d06ef85937f8eb.zip |
add entitlement api
Diffstat (limited to 'proxy/code/scripts/test-entitlementapi.py')
-rwxr-xr-x | proxy/code/scripts/test-entitlementapi.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/proxy/code/scripts/test-entitlementapi.py b/proxy/code/scripts/test-entitlementapi.py new file mode 100755 index 0000000..8930316 --- /dev/null +++ b/proxy/code/scripts/test-entitlementapi.py @@ -0,0 +1,28 @@ +#!/usr/bin/python + +import httplib, urllib +import sys +import simplejson + +if len(sys.argv) < 1: + print("please supply a message") + sys.exit(1) + +params = urllib.urlencode({'name':'entitlement'}) +headers = {"Content-type":"application/json", + "Accept": "application/json"} +conn = httplib.HTTPConnection("localhost", 8080) +conn.request("POST", '/candlepin/entitlement', params, headers) +response = conn.getresponse() +print("Status: %d Response: %s" % (response.status, response.reason)) +rsp = response.read() +conn.close() +print("create: %s" % rsp) + +response = urllib.urlopen('http://localhost:8080/candlepin/entitlement/candlepin') +rsp = response.read() +print("get: %s" % rsp) + +response = urllib.urlopen('http://localhost:8080/candlepin/entitlement/list') +rsp = response.read() +print("list: %s" % rsp)
\ No newline at end of file |