Chrome Cookiejar
This module helps to utilize your Chrome cookies in Python scripts. It's especially useful when scraping sites that requires login, as you can test your ideas easily without solving the CAPTCHAs and emulating the whole login process.
Supported platforms
This package is only tested on Python 3.
Please also note that values of cookies are encrypted with platform specific algorithms since Chrome 33. The decrypt helper for Windows is already included; however, only older versions of Chrome is currently supported on macOS or Linux.
Get started
Use the following code snippet to create an instance of http.cookiejar.CookieJar that includes all cookies from your Chrome browser:
>>> from chrome_cookiejar import ChromeCookieJar
>>> cookiejar = ChromeCookieJar('/path/of/your/Cookies') # doctest: +SKIP
The file path is optional; if omitted, the library will try to read cookies from the default user profile path of Chrom(ium).
If you're not sure, check chrome://version and follow the Profile Path shown here.
As the Cookies file is a SQLite database, you could filter the host domain with SQL wildcards:
>>> import requests, re
>>> jar = ChromeCookieJar(host_filter='%gith_b.com')
>>> login_user = re.compile(r'<meta name="user-login" content="(.+?)">')
>>> login_user.findall(requests.get('https://github.com', cookies=None).text)
[]
>>> login_user.findall(requests.get('https://github.com', cookies=jar).text)
['Arnie97']
Metadata
Release files for chrome-cookiejar 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chrome-cookiejar-0.1.0.tar.gz | 5.6 kB | Without provenance | Details for chrome-cookiejar-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chrome_cookiejar-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for chrome_cookiejar-0.1.0-py3-none-any.whl |
Total release size: 12.9 kB
Security for chrome-cookiejar 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.