SSL Authentication using httplib with Certificates
Revision as of 11:08, 4 December 2008 by PeterHarding (talk | contribs) (New page: <pre> import httplib KEYFILE = path of key file CERTFILE = path of cert file HOSTNAME = host conn = httplib.HTTPSConnection( HOSTNAME, port = port, key_file = KE...)
import httplib
KEYFILE = path of key file
CERTFILE = path of cert file
HOSTNAME = host
conn = httplib.HTTPSConnection(
HOSTNAME,
port = port,
key_file = KEYFILE,
cert_file = CERTFILE
)
template = """soap template"""
conn.putrequest('POST', 'soapaction')
conn.putheader("User-Agent", "Python post")
conn.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
conn.putheader("Content-length", "%d" % len(tem))
conn.putheader("SOAPAction", "\"\"")
conn.endheaders()
conn.send(template)
response = conn.getresponse()
print response.read()