python post submit gzip form data

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)

If you need to solve the problem, join the group
insert image description here

Guess you like

Origin blog.csdn.net/m0_38124502/article/details/112980758