title: Python SSL client certificate
body: <p>I am trying to use client side certificates for authentication in Python, but I just can't figure it out.</p>
  
  <p>I am using this for my testing:
  <a href="https://blog.cloudflare.com/introducing-tls-client-auth/" rel="nofollow noreferrer">https://blog.cloudflare.com/introducing-tls-client-auth/</a>
  (Skip to "TLS Client Authentication On The Edge" for the pem file and example curl call).</p>
  
  <p>It works as expected in curl, but when I try it in Python I get a 403 back from the server.</p>
  
  <p>Here is what I have tried in Python:</p>
  
  <pre><code>import ssl
  import socket
  s = socket.socket()
  addr_info = socket.getaddrinfo('auth.pizza',443)
  addr = addr_info[0][-1]
  ss = ssl.wrap_socket(s, certfile='pizza.pem')
  ss.connect(addr)
  ss.write(b'GET / HTTP/1.0\r\n\r\n')
  print(ss.read(4096))
  </code></pre>
  
  <p>I'm at a loss for how to even debug this further.</p>