Make post request using m2urllib2 from M2Crypto

I was debugging a POST request initiated by m2urllib2.urlopen(req) without success. All I got are GET request. Till this morning I realized one parameter has been causing problems.

Old request (GET request)

req = m2urllib2.Request('https://openam.example.com:8445/openam/json/piv/authenticate','None', headers)
res = m2urllib2.urlopen(req)

Revised request (POST request)

req = m2urllib2.Request('https://openam.example.com:8445/openam/json/piv/authenticate','', headers)
res = m2urllib2.urlopen(req)
Pay attention to the second parameter in m2urllib2.Request, if I use 'None', it would be GET request; if I use '', it would be POST request. I could not find out why.

No comments:

Post a Comment

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...