jmeter与python上传文件方式

 

 

 MIME类型可根据抓包进行调整multipart/form-data;文件名称可进行参数化

jmeter与python上传文件方式

 

 备注:

最近在做上传文件接口时,postman可以调通,但是jmeter一直不通,抓包比较了两种调用方式后,jmeter上传文件提示:failed to decode multipart body,尝试了各种方式,最后在网上找到了解决方式,删除header中的Content-Type

 

参考链接:https://www.pianshen.com/article/53921634810/

 

---------------------------------------------python上传图片-----------------------------------------------------

import requests
import pandas as pd
import json
import time
from datetime import datetime
import threading
import random
import sys
import os


def send_post_image_nsfw(img_path):
    """
    :param img:
    :return:
    """
    files={
        'img_path':open(img_path, 'rb').read()
    }
    params = {

    }
html = requests.post(url = 'xxxxxxxxx', files=files, params=params).text print(html) return html 
if __name__ == '__main__': 
file = 'E:\\6a3b6cf10e3fd4427d1f581f7ec2a2fb.jpg' send_post_image_nsfw(file)

 

相关文章:

  • 2021-11-30
  • 2021-06-21
  • 2021-12-25
  • 2022-12-23
猜你喜欢
  • 2021-11-20
  • 2021-10-09
  • 2021-07-27
  • 2021-04-19
  • 2021-08-08
  • 2021-05-01
  • 2021-10-18
相关资源
相似解决方案