Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserCookieError: Unable to get key for cookie decryption #214

Open
wimglenn opened this issue Oct 25, 2024 · 2 comments · May be fixed by #215
Open

BrowserCookieError: Unable to get key for cookie decryption #214

wimglenn opened this issue Oct 25, 2024 · 2 comments · May be fixed by #215

Comments

@wimglenn
Copy link
Contributor

Since a recent Chrome update, I'm starting to get:

>>> import browser_cookie3 as bc3
>>> bc3.chrome(domain_name="citibikenyc.com")
---------------------------------------------------------------------------
BrowserCookieError                        Traceback (most recent call last)
Cell In[6], line 1
----> 1 bc3.chrome(domain_name="citibikenyc.com")

File ~/git/scratch/.venv/lib/python3.13/site-packages/browser_cookie3/__init__.py:1160, in chrome(cookie_file, domain_name, key_file)
   1156 def chrome(cookie_file=None, domain_name="", key_file=None):
   1157     """Returns a cookiejar of the cookies used by Chrome. Optionally pass in a
   1158     domain name to only load cookies from the specified domain
   1159     """
-> 1160     return Chrome(cookie_file, domain_name, key_file).load()

File ~/git/scratch/.venv/lib/python3.13/site-packages/browser_cookie3/__init__.py:515, in ChromiumBased.load(self)
    511 else:
    512     expires = (expires_nt_time_epoch / 1000000) - \
    513         self.UNIX_TO_NT_EPOCH_OFFSET
--> 515 value = self._decrypt(value, enc_value)
    516 c = create_cookie(host, path, secure, expires,
    517                   name, value, http_only)
    518 cj.set_cookie(c)

File ~/git/scratch/.venv/lib/python3.13/site-packages/browser_cookie3/__init__.py:585, in ChromiumBased._decrypt(self, value, encrypted_value)
    583     except ValueError:
    584         pass
--> 585 raise BrowserCookieError('Unable to get key for cookie decryption')

BrowserCookieError: Unable to get key for cookie decryption

I'm on macOS and Chrome Version 130.0.6723.70 (Official Build) (arm64)

@Arth-ur Arth-ur linked a pull request Oct 25, 2024 that will close this issue
@ustcxmwu
Copy link

I found a solution and it works for me.
https://stackoverflow.com/questions/79132015/browser-cookie3-browsercookieerror-unable-to-get-key-for-cookie-decryption

@BigSnaill
Copy link

wow!its cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants