当前位置:网站首页>搞定带WebKitFormBoundary post登录
搞定带WebKitFormBoundary post登录
2022-07-07 18:03:00 【nongcunqq】
关键点post时headers中boundary和data中的boundary数据要一致 'Content-Type': f'multipart/form-data; boundary=----{web_boundary}',
随机生成16位大小写字母+数字
import requests
import random,string
from requests_toolbelt import MultipartEncoder
fields = {
'file': ('test.png', your_data, "image/png"),
'file_id': "0"
}
boundary = '----WebKitFormBoundary' \
+ ''.join(random.sample(string.ascii_letters + string.digits, 16))
m = MultipartEncoder(fields=fields, boundary=boundary)
headers = {
"Host": "xxxx",
"Connection": "keep-alive",
"Content-Type": m.content_type
}
req = requests.post('https://xxxx/api/upload', headers=headers, data=m)
print(req.text)
边栏推荐
- [sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
- LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
- 剑指 Offer II 013. 二维子矩阵的和
- 数据孤岛是企业数字化转型遇到的第一道险关
- 8 CAS
- IP 工具类
- The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin
- RESTAPI 版本控制策略【eolink 翻译】
- ASP. Net kindergarten chain management system source code
- Interpretation of transpose convolution theory (input-output size analysis)
猜你喜欢
随机推荐
力扣 459. 重复的子字符串
Implement secondary index with Gaussian redis
浏览积分设置的目的
力扣 2319. 判断矩阵是否是一个 X 矩阵
Force buckle 674 Longest continuous increasing sequence
el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。
Semantic slam source code analysis
毕业季|遗憾而又幸运的毕业季
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
pom. XML configuration file label: differences between dependencies and dependencymanagement
A pot of stew, a collection of common commands of NPM and yarn cnpm
Boot 和 Cloud 的版本选型
Time tools
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
一锅乱炖,npm、yarn cnpm常用命令合集
Introduction to bit operation
My creation anniversary
编译器优化那些事儿(4):归纳变量








