diff options
Diffstat (limited to 'vcpe_beijing/mockserver/8774-client-python3.py')
-rw-r--r-- | vcpe_beijing/mockserver/8774-client-python3.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vcpe_beijing/mockserver/8774-client-python3.py b/vcpe_beijing/mockserver/8774-client-python3.py new file mode 100644 index 0000000..985af0c --- /dev/null +++ b/vcpe_beijing/mockserver/8774-client-python3.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import http.client + +conn = http.client.HTTPConnection("localhost:8774") +print ("Connected.") +conn.request("GET", "/v2.1/b45461e4b03547db8f2869d2c9f9e29e") +r1 = conn.getresponse() +print (r1.status) + +conn.request("GET", "/v2.1/") +r2 = conn.getresponse() +print (r2.status) + +conn.request("GET", "/v2.1/b45461e4b03547db8f2869d2c9f9e29e/servers/detail") +r3 = conn.getresponse() +print (r3.status) + +data3 = r3.read().decode() +data2 = r2.read().decode() +data1 = r1.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) |