Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the cookies database of firefox when firefox is running with python?

Tags:

python

cookies

I want to access the cookies programmatically which are stored in the cookies database on the filesystem. I tried to use this code, but it either gives a message

database is locked

when the browser is running, or does not yield any results when the browser has been quit (I assume all cookies are removed on the filesystem then?).

How can I programmatically access all cookies related to a browser session with python? I want to have a script that e.g. lists all the cookies on a terminal. How to do that? (Can be either chrome or firefox).

like image 905
Alex Avatar asked Dec 14 '25 21:12

Alex


1 Answers

the problem is because that Firefox uses SQLite to obtain an EXCLUSIVE lock on the database (link)

the solution is to make a backup copy of the database befor read it

like image 113
Belhadjer Samir Avatar answered Dec 16 '25 10:12

Belhadjer Samir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!