import urllib.request, urllib.error, urllib.parse
import http.cookiejar
jar = http.cookiejar.FileCookieJar('cookies')
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)
Принимать файлы cookie в Python