Skip to content

Instantly share code, notes, and snippets.

@hoov
Created October 12, 2016 15:57
Show Gist options
  • Save hoov/eaa2dbad086cfc38bb6aedeb5adeb918 to your computer and use it in GitHub Desktop.
Save hoov/eaa2dbad086cfc38bb6aedeb5adeb918 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import httplib
import urllib2
import requests
def trace(s, *n):
print(str(s) % n)
def test_tls():
url = "https://www.emulate.io"
url = "https://tls1test.salesforce.com"
trace("Trying urllib2")
urllib2.urlopen(url).read()
trace("Trying httplib")
conn = httplib.HTTPSConnection("www.emulate.io", strict=True)
conn.request("GET", "/")
resp = conn.getresponse()
print(resp.read())
trace("Trying requests")
requests.get(url, verify=True)
if __name__ == "__main__":
test_tls()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment