Questions tagged [cookielib]

The cookielib module defines classes for automatic handling of HTTP cookies. It is useful for accessing web sites that require small pieces of data – cookies – to be set on the client machine by an HTTP response from a web server, and then returned to the server in later HTTP requests.

The cookielib module of Python 2 defines classes for automatic handling of HTTP cookies.

The following classes are provided:

cookielib.CookieJar: stores HTTP cookies. It extracts cookies from HTTP requests and returns them in HTTP responses.

cookielib.FileCookieJar: load and save cookies from a file.

cookielib.DefaultCookiePolicy: implements the standard accept and reject rules for Netscape and RFC 2965 cookies. By default, RFC 2109 cookies are treated according to the RFC 2965 rules.

cookielib.Cookie: represents Netscape, RFC 2109 and RFC 2965 cookies.

The cookielib module has been renamed to http.cookiejar in Python 3.

For more information look at https://docs.python.org/2/library/cookielib.html

65 questions
0
votes
2 answers

cookielib and form authentication woes in Python

InstaMapper is a GPS tracking service that updates the device's position more frequently when the device is being tracked live on the InstaMapper webpage. I'd like to have this happen all the time so I thought I'd write a python script to login to…
Matt
  • 4,815
  • 5
  • 39
  • 40
0
votes
1 answer

Translating Python 2 code to Python 3

Can anybody help me translating this python 2 code to python 3 without using the 2to3 tool ? import urllib2, cookielib self.cj = cookielib.MozillaCookieJar(self.cookie_file) self.opener = urllib2.build_opener( …
sgp
  • 1,738
  • 6
  • 17
  • 31
0
votes
2 answers

python urllib2 document.login

How would you go about logging into a website that is set up like so, using python urllib2 The below is the javascript handler on the form and a onsubmit. How would I process this in python?