当前位置:网站首页>搞定带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)
边栏推荐
- JVM GC垃圾回收简述
- 线性基
- 9 atomic operation class 18 Rohan enhancement
- Force buckle 674 Longest continuous increasing sequence
- Visual Studio 插件之CodeMaid自动整理代码
- Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
- 最多可以参加的会议数目[贪心 + 优先队列]
- 多个线程之间如何协同
- TS快速入门-泛型
- The project manager's "eight interview questions" is equal to a meeting
猜你喜欢
Cloud 组件发展升级
PMP每日一练 | 考试不迷路-7.7
vulnhub之school 1
Force buckle 2319 Judge whether the matrix is an X matrix
Sword finger offer II 013 Sum of two-dimensional submatrix
Compiler optimization (4): inductive variables
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
RESTAPI 版本控制策略【eolink 翻译】
BI的边界:BI不适合做什么?主数据、MarTech?该如何扩展?
PMP practice once a day | don't get lost in the exam -7.7
随机推荐
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
gorilla官方:golang开websocket client的示例代码
多个线程之间如何协同
整型int的拼接和拆分
力扣 2315.统计星号
CSDN syntax description
R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
Introduction to bit operation
Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
浏览积分设置的目的
Ways to improve the utilization of openeuler resources 01: Introduction
Simulate the implementation of string class
最多可以参加的会议数目[贪心 + 优先队列]
【Confluence】JVM内存调整
Equals method
TS快速入门-泛型
Some arrangements about oneself
力扣599. 两个列表的最小索引总和
LeetCode_ 7_ five
国家网信办公布《数据出境安全评估办法》:累计向境外提供10万人信息需申报