Created
January 29, 2020 12:55
-
-
Save kudarisenmon/3db58c46f54321e043333ff757b0f497 to your computer and use it in GitHub Desktop.
print cookies from GET request on python3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from urllib.request import build_opener, HTTPCookieProcessor | |
| from urllib.parse import urlencode | |
| from http.cookiejar import CookieJar | |
| import pprint | |
| cookie_jar = CookieJar() | |
| opener = build_opener(HTTPCookieProcessor(cookie_jar)) | |
| res = opener.open('https://www.google.com') | |
| #pprint.pprint(res.getheaders()) | |
| res.close() | |
| for cookie in cookie_jar: | |
| print(cookie) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment