from tomorrow import threads
import os
import time
import requests
@threads(5)
def test(picpath):
url = r'http://xxxxxxx:8000/plateTest/'
#执行post请求
myfile = {"picfile":open(picpath,'rb')}
r = requests.post(url=url,files=myfile)
r.encoding = 'utf-8'
#打印返回结果
info = r.json()
print(info)
if __name__ == "__main__":
dirpath = r'C:/Users/zc/Pictures/plate/'
pics = [dirpath+i for i in os.listdir(dirpath)]
t1 = time.time()
for picpath in pics:
test(picpath)
print(time.time()-t1)