summaryrefslogtreecommitdiffstats
path: root/proxy/code/scripts
diff options
context:
space:
mode:
authorjesus m. rodriguez <jesusr@redhat.com>2009-06-26 14:33:21 -0400
committerjesus m. rodriguez <jesusr@redhat.com>2009-06-26 14:33:21 -0400
commit2ab21a6332fa4c39fa543c970d90279d6b316be8 (patch)
tree683bb48e5e11f2f9d0dc9757bf11eaf2e6ecbd57 /proxy/code/scripts
parent6d46157fdf4cedeef9d0f0a8bca6634f97511357 (diff)
downloadcandlepin-2ab21a6332fa4c39fa543c970d90279d6b316be8.tar.gz
candlepin-2ab21a6332fa4c39fa543c970d90279d6b316be8.tar.xz
candlepin-2ab21a6332fa4c39fa543c970d90279d6b316be8.zip
GET & POST methods work.
Use test-connection.py MSG to test the api interaction.
Diffstat (limited to 'proxy/code/scripts')
-rwxr-xr-xproxy/code/scripts/test-connection.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/proxy/code/scripts/test-connection.py b/proxy/code/scripts/test-connection.py
new file mode 100755
index 0000000..78d1798
--- /dev/null
+++ b/proxy/code/scripts/test-connection.py
@@ -0,0 +1,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({'message':sys.argv[1]})
+headers = {"Content-type":"application/x-www-form-urlencoded",
+ "Accept": "text/plain"}
+conn = httplib.HTTPConnection("localhost", 8080)
+conn.request("POST", '/candlepin/helloworld', 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)