summaryrefslogtreecommitdiffstats
path: root/vcpe_beijing/mockserver/5000-client-python3.py
diff options
context:
space:
mode:
Diffstat (limited to 'vcpe_beijing/mockserver/5000-client-python3.py')
-rw-r--r--vcpe_beijing/mockserver/5000-client-python3.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/vcpe_beijing/mockserver/5000-client-python3.py b/vcpe_beijing/mockserver/5000-client-python3.py
new file mode 100644
index 0000000..d548f68
--- /dev/null
+++ b/vcpe_beijing/mockserver/5000-client-python3.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+import http.client
+
+conn = http.client.HTTPConnection("localhost:5000")
+print ("Connected.")
+conn.request("GET", "/")
+r1 = conn.getresponse()
+print (r1.status)
+
+conn.request("POST", "/v3/auth/tokens")
+r2 = conn.getresponse()
+print (r2.status)
+
+conn.request("POST", "/v2.0/tokens")
+r3 = conn.getresponse()
+print (r3.status)
+
+data1 = r1.read().decode()
+data2 = r2.read().decode()
+data3 = r3.read().decode()
+print("This is first response:")
+print("-------------------------------")
+print(data1)
+print("This is second response:")
+print("-------------------------------")
+print(data2)
+print("This is third response:")
+print("-------------------------------")
+print(data3)