github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cli/interactive_tests/test_auth_cookie.py (about) 1 import urllib2 2 import ssl 3 import sys 4 5 cookiefile = sys.argv[1] 6 url = sys.argv[2] 7 8 # Disable SSL cert validation for simplicity. 9 ctx = ssl.create_default_context() 10 ctx.check_hostname = False 11 ctx.verify_mode = ssl.CERT_NONE 12 13 # Load the cookie. 14 cookie = file(cookiefile).read().strip() 15 16 # Perform the HTTP request. 17 httpReq = urllib2.Request(url, "", {"Cookie": cookie}) 18 print urllib2.urlopen(httpReq, context=ctx).read()