Reputation: 323
I'm trying to extract FF cookie from it's database (cookies.sqlite). However, seems that only cookies with expiration date can be found there (I am searching the one that expires when session ends). I even turned the "remember open tabs" feature of FF on. I don't get it - what's the fundamental difference between them. I can see the cookie in FF UI but cannot find on the hard drive.
Any anwers appreciated.
Upvotes: 10
Views: 6865
Reputation: 29452
Farlan is correct the session cookies are stored in the sessionstore.js file. I created a module to load cookies from sqlite and this session file, available here: https://bitbucket.org/richardpenman/browser_cookie/
Example usage:
import requests
import browser_cookie
cj = browser_cookie.firefox()
r = requests.get('http://stackoverflow.com', cookies=cj)
Upvotes: 1
Reputation: 1900
Session cookies are stored in the sessionstore.js
file.
This file is essentially a JSON object. If you parse it, look under windows[0].cookies
to get an array of the session cookies.
Typically the only fields in each session cookie are {name, host, path, value}
, but occasionally you see an httpOnly
parameter.
Upvotes: 7
Reputation: 11
I was looking for the same thing and found this: http://blog.mithis.net/archives/python/90-firefox3-cookies-in-python I guess the right thing to do is to use the code to add another cookiejar backend
Upvotes: 1
Reputation: 2426
session cookies probably are kept in memory and deleted once the tab/browser is closed, never entering the database.
Upvotes: 0