Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion code/tutorlib/online/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@
SERVER = 'http://csse1001.uqcloud.net/cgi-bin/mpt3/mpt_cgi.py'


import ssl

def make_opener():
"""Make a URL opener with cookies enabled, and proxies disabled."""
cookiejar = http.cookiejar.CookieJar()
proxy_handler = urllib.request.ProxyHandler(proxies={})
cookie_processor = urllib.request.HTTPCookieProcessor(cookiejar=cookiejar)
opener = urllib.request.build_opener(cookie_processor, proxy_handler)
# Disable SSL certificate verification to work around issues on Windows 8
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
https_handler = urllib.request.HTTPSHandler(context=ssl_context)
opener = urllib.request.build_opener(cookie_processor, proxy_handler, https_handler)
return opener


Expand Down