HermSang
HermSang

Reputation: 107

How to send POST request using Python-Requests to a Java Serverlet Endpoint

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

enter image description here

payload = ...

r = requests.post(url, headers=headers, json=payload)

What does the payload have to be in order to send this request through correctly?

Upvotes: 0

Views: 126

Answers (1)

furas
furas

Reputation: 142859

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 convert curl code to Python code.

Upvotes: 1

Related Questions