python:发送图片 url 给 importer: importer_send_image.py (get 请求)


 

import requests
import time

############ importer 发送图片 url ###############
###### 所有 url 保存在 url 文件中 ###############

# 起始号码
urlFile = 'D:\\PythonProject1\\daxing_allpic_new.txt'
outputFile = 'D:\\PythonProject1\\daxing_allpic_newoutput.txt'
num = 0
importerToBeSent = "http://192.168.2.22:31080/general?img="
deviceId = "9999"
sleepTime = 1
outFile = open(outputFile, 'a')

with open(urlFile) as url_object:
for url in url_object:
url = url.rstrip("\n")
num = num + 1
Str = importerToBeSent + url + "&sensor=" + deviceId + "&width=250&height=250&ts=1542888600000"
response = requests.get(Str)
time.sleep(sleepTime)
if response.status_code == 200:
print(num)
print("==200=" + Str)
else:
print("Wrong!!" + Str)

#根据之前的计算,在笔记本上运行,大约可以达到 100 QPS 的速度

 

posted @ 2019-10-03 08:36  allenbackpacker  阅读(262)  评论(0)    收藏  举报