Cookiejar allows user to use many methods. Some of its methods will be discussed in next
articles
First method
CookieJar.
add_cookie_header
(request)
This method adds correct Cookie header to request i.e if rfc2965 attribute of CookiePolicy and hide_cookie2 attribute are true and false then Cookie2 is also added when it is appropriate..
request - It is usually a instance ofurllib.request.Request and it must supports the methods get_full_url(), get_host(), get_type(), unverifiable(), has_header(), get_header(), header_items(), ad_unredirected_header() and origin_req_host attribute as documented by urllib.request.
Code:
def http_request(self, request):
self.cookiejar.add_cookie_header(request)
return request
you can pass the request parameter as per your convenience .
Next Article : https://cppsecrets.com/users/1380797110117112971091151051101031044948555664103109971051084699111109/python-httpcookiejar-CookieJarextractcookies.php
Comments