当前位置:网站首页>搞定带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)
边栏推荐
- 841. 字符串哈希
- 力扣 459. 重复的子字符串
- Notes...
- 一文读懂数仓中的pg_stat
- Force buckle 674 Longest continuous increasing sequence
- Ucloud is a basic cloud computing service provider
- ASP. Net gymnasium integrated member management system source code, free sharing
- Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
- 多个线程之间如何协同
- openEuler 资源利用率提升之道 01:概论
猜你喜欢
![最多可以参加的会议数目[贪心 + 优先队列]](/img/f3/e8e939e0393efc404cc159d7d33364.png)
最多可以参加的会议数目[贪心 + 优先队列]

CSDN syntax description

LeetCode_ 7_ five

mysql 的一些重要知识

ASP.NET学习& asp‘s one word
![[RT thread env tool installation]](/img/bc/9b39651d40a240f0893200793f67e9.png)
[RT thread env tool installation]

Leetcode force buckle (Sword finger offer 36-39) 36 Binary search tree and bidirectional linked list 37 Serialize binary tree 38 Arrangement of strings 39 Numbers that appear more than half of the tim

模拟实现string类

Cloud 组件发展升级

Ways to improve the utilization of openeuler resources 01: Introduction
随机推荐
ASP.NET体育馆综合会员管理系统源码,免费分享
Interpretation of transpose convolution theory (input-output size analysis)
吞吐量Throughout
SQL common optimization
BI的边界:BI不适合做什么?主数据、MarTech?该如何扩展?
IP 工具类
力扣674. 最长连续递增序列
时间工具类
Semantic slam source code analysis
让这个 CRMEB 单商户微信商城系统火起来,太好用了!
Chapter 20 using work queue manager (3)
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
YoloV6:YoloV6+Win10---训练自己得数据集
8 CAS
Le PGR est - il utile au travail? Comment choisir une plate - forme fiable pour économiser le cœur et la main - d'œuvre lors de la préparation de l'examen!!!
数据孤岛是企业数字化转型遇到的第一道险关
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置palette参数自定义不同水平小提琴图的填充色、add参数在小提琴图添加箱图
微信公众号OAuth2.0授权登录并显示用户信息
Force buckle 674 Longest continuous increasing sequence
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