I have this simple working curl command:
curl -k -d X-User=user -d X-Password=password https://12.12.12.21
This is my example:
import urllib2
opener = urllib2.build_opener()
opener.addheaders = [('X-User', 'user'),('X-Password', 'password')]
rr = opener.open("https://12.12.12.21")
print rr.read()
It’s not working as i expected ( result: wrong password/user name ), can you help me understand why?
Your
curlcommand is using the-dflag which sends the data using POST, not using headers.If you meant to use headers then you need to use the
-Hargument:Here is how to do a POST request in case that is what you need: