如何使用Python-Requests将发布请求发送到Java Serverlet端点
检查Chrome的流量,我可以看到Chrome在下面看起来像这样的有效载荷。这不像正常形式或JSON数据,我可以将其发布为词典。
我在下面附上流量的文本副本:
callCount=1
nextReverseAjaxIndex=0
c0-scriptName=IssueDataLookup
c0-methodName=getIssueDisplayDatas
c0-id=0
c0-e2=string:79766DGF0
c0-e3=null:null
c0-e4=string:MUNI
c0-e1=Object_Object:{cusip:reference:c0-e2, tmcScaleId:reference:c0-e3, debtType:reference:c0-e4}
c0-param0=array:[reference:c0-e1]
batchId=4
instanceId=0
page=%2Ftmc%2FTMCEnter
scriptSessionId=Jqwkwz1udhEOzO!7e9!hCxADydMNEmwYN7o/r9wYN7o-ugUYKsCGc
payload = ...
r = requests.post(url, headers=headers, json=payload)
Inspecting chrome traffic, I can see Chrome sends a payload that looks like this below. This is not like normal form or json data I can post as a dictionary.
I am attaching the text copy of the traffic below here:
callCount=1
nextReverseAjaxIndex=0
c0-scriptName=IssueDataLookup
c0-methodName=getIssueDisplayDatas
c0-id=0
c0-e2=string:79766DGF0
c0-e3=null:null
c0-e4=string:MUNI
c0-e1=Object_Object:{cusip:reference:c0-e2, tmcScaleId:reference:c0-e3, debtType:reference:c0-e4}
c0-param0=array:[reference:c0-e1]
batchId=4
instanceId=0
page=%2Ftmc%2FTMCEnter
scriptSessionId=Jqwkwz1udhEOzO!7e9!hCxADydMNEmwYN7o/r9wYN7o-ugUYKsCGc
payload = ...
r = requests.post(url, headers=headers, json=payload)
What does the payload have to be in order to send this request through correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它可以是正常的帖子/表格,但Chrome可能以更可读的方式显示它。
您应该检查它是否具有将其显示为原始/源数据的选项。
但是Chrome应该具有将请求复制为
curl
代码的功能 - 稍后您可以使用页面 curlconverrer“> curlconverter.com < /a>将curl
代码转换为Python代码。It can be normal POST/form but Chrome may display it in more readable way.
You should check if it has option to display it as raw/source data.
But Chrome should have function to copy request as
curl
code - and later you can use page curlconverter.com to convertcurl
code to Python code.