What is a cookie ?
A cookie is a file that is saved to PC , mobile or tablets. It stores the website's name and also unique id that represents us a user. Now in python we have multiple modules to handle cookies that are saved in the system of user and one such module that helps to deal with cookies are http.cookiejar.
http.cookiejar is a module that define classes for the automatic handling of HTTP cookies. The use of this module is that is used to access small websites that uses small pieces of data i.e cookies to save the information of client machine by an HTTP response from a web server and then later return to server through HTTP requests.
import http.cookiejar, urllib.request
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
r = opener.open("http://web.whatsapp.com/")
The output we got is the response that we get from HTTP server
Next Article :