summaryrefslogtreecommitdiffstats
path: root/vcpe_beijing/mockserver/8774-client-python3.py
blob: 985af0c79bbdb5d38b3f2b5ada0523a41b7928f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)