browser_cookie3
browser_cookie3 copied to clipboard
accessing chromium storage fails on debian 11
If I use the generic load()
function, the lib fails in chromium mode:
Traceback (most recent call last):
File "/home/user/bin/myscript.py", line 247, in <module>
main()
File "/home/user/bin/myscript.py", line 236, in main
test_api(project)
File "/home/user/bin/myscript.py", line 187, in test_api
r = get(baseurl + "/project/" + project)
File "/home/user/bin/myscript.py", line 99, in get
s = get_cookie_session()
File "/home/user/bin/myscript.py", line 81, in get_cookie_session
cookies = browser_cookie3.load()
File "/usr/local/lib/python3.9/dist-packages/browser_cookie3/__init__.py", line 672, in load
for cookie in cookie_fn(domain_name=domain_name):
File "/usr/local/lib/python3.9/dist-packages/browser_cookie3/__init__.py", line 638, in chromium
return Chromium(cookie_file, domain_name, key_file).load()
File "/usr/local/lib/python3.9/dist-packages/browser_cookie3/__init__.py", line 297, in load
value = self._decrypt(item[5], item[6])
File "/usr/local/lib/python3.9/dist-packages/browser_cookie3/__init__.py", line 361, in _decrypt
return decrypted.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa5 in position 3: invalid start byte
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
$ cat /etc/debian_version
11.2
Is it possible, to specify the mechanisms or stores that the load() function should use?
If not, that would be a neat feature. For example, I would personally skip the linux dbus libsecret extraction, but keep all the browsers in there. Maybe by specifying a list of callables? load(sources=[firefox,chrome,chromium,opera,edge])
Meanwhile, I'm using the firefox()
version, which works so far.