[Python] Example for Sending POST request via HTTPS

When you develop a tool to interact with HTTPS server, sometimes you need a code that can sending a POST request via HTTPS. I was searching the best example for my tool, but I couldn’t. So, I made the code referenced POST via HTTP and it works well. I post the sample code.

>>> import httplib, urllib
>>> params = urllib.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
              "Accept": "text/plain",
              "Other": "Header"}
>>> conn = httplib.HTTPSConnection("bugs.python.org") # HTTPSConnection instead of HTTPConnection
>>> conn.request("POST", "", params, headers)
>>> response = conn.getresponse()
>>> print response.status, response.reason
>>> data = response.read()
>>> print data
>>> conn.close()