data = {"jsonStr":jsonStr} files = { "log": open(filepath, "rb"), "report": open(filepath, "rb") } respon = requests.post(url, data, files=files) ...
与别人对接时经常会遇到既发送文件参数又发送字符串参数的请求,此请求的核心是 文件参数的ContenType multipart form data 字符串参数的ContenType application json 上面是发送请求的核心代码 下面是请求demo https: gitee.com xiaorenwu dashije request demo.git ...
2020-03-13 12:01 0 8018 推荐指数:
data = {"jsonStr":jsonStr} files = { "log": open(filepath, "rb"), "report": open(filepath, "rb") } respon = requests.post(url, data, files=files) ...
在使用httpclient发送post请求的时候,接收端中文乱码问题解决。 正文: 我们都知道,一般情况下使用post请求是不会出现中文乱码的。可是在使用httpclient发送post请求报文含中文的时候在发送端数据正常但是到了服务器端就中文乱码了。 解决办法: 发送端进行设置编码 ...
下面是把方法进行了封装 ...