python post 提交gzip表单数据

import requests
import json
import gzip
url = 'http://www.xxx.com'
headers = {
    
    
"Content-Type":"text/html",
"Content-Length":"1077",
"Host":"www.xxx.com",
"Connection":"Keep-Alive",
"Accept-Encoding":"gzip",
"User-Agent":"okhttp/3.8.0",
}
account = "10023235656"
data = gzip.compress(account.encode())#gzip压缩,接受bytes,json串转bytes也是可以的
res= requests.post(url,headers=headers,data=data)
print(res.text)

需要解决问题的话,进群
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_38124502/article/details/112980758