Looking for a urllib(2) cookie handler

Chris Rebert clp2 at rebertia.com
Tue Apr 19 14:01:40 CEST 2011

On Tue, Apr 19, 2011 at 4:44 AM, Mark Carter <alt.mcarter at gmail.com> wrote:
> I'm in python 2.6.5, and have Firefox 3.6.13. I would like to download
> some html from a site and scrape it programatically. The site requires
> a cookie, which I have in Firefox.
> Is there a simple python recipe I can use to read the contents of a
> url and say "just use the cookie that I have in Firefox"?

Untested (3rd Google hit for "import firefox cookies python"):

At a minimum, I think you'll need to replace:
from pysqlite2 import dbapi2 as sqlite
import sqlite3 as sqlite

You'll also have to figure out where Firefox's `cookies.sqlite` file
is located on your system.

My compiler is compiling, I swear!

More information about the Python-list mailing list