-
Notifications
You must be signed in to change notification settings - Fork 2
/
flaskclient.py
51 lines (45 loc) · 1.08 KB
/
flaskclient.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import requests
import cv2
import base64
with open("/home/xl/1/1.jpg", 'rb') as fin:
image_data = fin.read()
base64_data = base64.b64encode(image_data)
# fout = open('d:\\1a\\base64_content.txt', 'w')
# fout.write(base64_data.decode())
# fout.close()
user_info = {'photo': base64_data}
#user_info = {'photo': 'asasd'}
#print type(user_info)
r = requests.post("http://192.168.218.57:3000/Vehicletype", data=user_info)
print (r.text)
#print r.text
# print type(r)
# print type(r.text)
# print r.text
# print type (r.text)
import json
#
#
#
# json_str = json.dumps(r.text)
# print "json:",json_str
# print r.text
# print type (r.text)
#jd = json.loads(r.text)
# for name in jd:
# #print name
# #print ("hihi")
# #print name
# #print type (name)
# pname= name.pop("name")
# #print pname
# pdata = name.pop("content")
# import base64
# ori_image_data = base64.b64decode(pdata)
# fout = open('D:\\13\\'+pname, 'wb')
# fout.write(ori_image_data)
# fout.close()
#
# fout = open('d:\\1a\\test.txt', 'w')
# fout.write(r.text)
# fout.close()