我有一个问题,我无法发布已经被urlencoded的内容
应该如何
dataa = {
client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=eyJhbGci.....blahblahblah
}
r = scraper.post(url,headers=headers, data=dataa)
我试图使其像
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer&",
但这没用,有什么主意吗?
答案 0 :(得分:1)
您可以使用urllib.parse.unquote()
来解码数据:
from urllib.parse import unquote
source = "urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=eyJhbGci"
result = unquote(source)
如果要动态解码dict值,可以将其重写:
dataa["client_assertion_type"] = unquote(dataa["client_assertion_type"])
答案 1 :(得分:-1)
刚发现并在urldecoded字符串中表示换行,我用=表示:
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
希望对别人有帮助