when we use browser_cookie3.chromium(cookie_file="x:/path/to/cookies"),
if value and encrypted_value both empty in sqlite, and no key_file to get key.
then we get
Traceback (most recent call last):
File "x:\path\to\project\.venv\lib\site-packages\browser_cookie3\__init__.py", line 497, in _decrypt
return self._decrypt_windows_chromium(value, encrypted_value)
File "x:\path\to\project\.venv\lib\site-packages\browser_cookie3\__init__.py", line 488, in _decrypt_windows_chromium
_, data = _crypt_unprotect_data(encrypted_value)
File "x:\path\to\project\.venv\lib\site-packages\browser_cookie3\__init__.py", line 90, in _crypt_unprotect_data
raise RuntimeError('Failed to decrypt the cipher text with DPAPI')
RuntimeError: Failed to decrypt the cipher text with DPAPI
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "x:\path\to\project\.venv\lib\site-packages\browser_cookie3\__init__.py", line 1039, in chromium
return Chromium(cookie_file, domain_name, key_file).load()
File "x:\path\to\project\.venv\lib\site-packages\browser_cookie3\__init__.py", line 474, in load
value = self._decrypt(value, enc_value)
File "x:\path\to\project\.venv\lib\site-packages\browser_cookie3\__init__.py", line 501, in _decrypt
if not self.v10_key:
AttributeError: 'Chromium' object has no attribute 'v10_key'
there are two little bug.
1: check encrypted_value is empty failed, because encrypted_value's type is bytes.
when we use
browser_cookie3.chromium(cookie_file="x:/path/to/cookies")
, if value and encrypted_value both empty in sqlite, and no key_file to get key. then we getthere are two little bug.
1: check
encrypted_value
is empty failed, becauseencrypted_value
's type is bytes.https://github.com/borisbabic/browser_cookie3/blob/1f2193bcdc053e08931e7281bcda4601ceba26a5/browser_cookie3/__init__.py#L485
2: it has no attribute 'v10_key' there
https://github.com/borisbabic/browser_cookie3/blob/1f2193bcdc053e08931e7281bcda4601ceba26a5/browser_cookie3/__init__.py#L501
the reason is that there is no initialization here.
https://github.com/borisbabic/browser_cookie3/blob/1f2193bcdc053e08931e7281bcda4601ceba26a5/browser_cookie3/__init__.py#L414