opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))
print('Currently have %d cookies' % len(jar))
print('Getting page')
response = opener.open('http://google.com')
print(response.headers)
print('Got page')
print('Currently have %d cookies' % len(jar))
print(jar)
Accept Cookies in Python