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())

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章