file_object = open(RESULT_FILE, 'r')
jtlContent = file_object.read()
headers = {"Content-type":"multipart/form-data;","Accept": "text/plain"}
conn =httplib.HTTPConnection("10.6.208.175:80")
finalUrl="%s?taskId=%s&resultId=%s&agentId=%s&agentType=%s&scriptType=%s" % ("/ResultServer/ResultServlet",TASK_ID,RESULT_ID,agentComm.getConfigValue('workerId'),agentComm.getConfigValue('envAlias'),SCRIPT_TYPE)
conn.request("POST",finalUrl,jtlContent, headers)
response = conn.getresponse()
print ("result deal info:",response.status, response.reason,response.read())
本文详细阐述了如何使用Python通过HTTP连接发送POST请求,并解析返回的结果,包括构建请求头、构造URL、发送请求和接收响应的过程。
2219

被折叠的 条评论
为什么被折叠?



