Background
I have succesfully made some HTTP GET requests with pypiwin32 using
import pythoncom
import win32com.client
pythoncom.CoInitialize()
h = win32com.client.Dispatch('WinHTTP.WinHTTPRequest.5.1')
h.SetAutoLogonPolicy(0) # log in automatically
h.Open('GET', url, True)
h.Send()
and later getting the response status and text from h.status
and h.responseText
Problem
pywin32 (or should I say pypiwin32) does not seem to have official docs, and the Microsoft WinHttpRequest object docs has only C++ examples.
Question
How to make a HTTP POST request with a specific payload and Headers using the win32com.client from pywin32? Lets say that the HTTP Request Headers I want to add are
Referer: http://example.com/analysis.aspx?ID=527776455
Cookie: ASP.NET_SessionId=51jrf2r
and the payload I want to POST is
{"Id":"8974552","Action":"Analysis"}