title: Example of including a certficate in a post request with python and http.client
body: <p>I am trying to POST xml to a site using python. I have to include a certificate but am unsure of how to do this. Is it enough to specify the file path of the certificate locally on my computer?</p>
  
  <p>Can anybody show my an example of how to include the certificate in the request?</p>
  
  <pre><code>import http.client, urllib.parse
  
  xml="""&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;home&gt;
    &lt;bathroom&gt;1&lt;/bathroom&gt;
    &lt;kitchen&gt;1&lt;/kitchen&gt;
    &lt;street&gt;515&lt;/street&gt;
  &lt;/home&gt;);"""
  
  headers = {"username": "password"}
  
  conn = http.client.HTTPSConnection("someurl.com", cert_file="D:\Users\Username\certificate.p12")
  conn.request("POST", "/to/this/place", xml, headers)
  response = conn.getresponse()
  print(response.status, response.reason)
  data = response.read()
  print(data)
  conn.close()
  </code></pre>