hhnf333 发表于 2017-4-26 08:24:11

python post文件

  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())
页: [1]
查看完整版本: python post文件