Skip to main content

Python library for retrieving cookies from the Chrome browser

Project description

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']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chrome-cookiejar-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

chrome_cookiejar-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file chrome-cookiejar-0.1.0.tar.gz.

File metadata

  • Download URL: chrome-cookiejar-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

File hashes

Hashes for chrome-cookiejar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 721ad6ca1cadb6fb50e3a26b404c33b9635dc6bc995879d17f4deebf20b14c25
MD5 c8d6f1035c2a30fd4b571a817466cfb2
BLAKE2b-256 f1ed75a55d7dc5ba06d9aac96bf58efc92f4d578679942e7beb068f6c88feab7

See more details on using hashes here.

File details

Details for the file chrome_cookiejar-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chrome_cookiejar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

File hashes

Hashes for chrome_cookiejar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e409701080c9e4a1c7fdc463c488e56fc40a822e5cd36a070b39b6fe6262c5a7
MD5 8aff9ff29c0d3ba5932fc227c6b26503
BLAKE2b-256 ff268f47baa26a4809970f4756aa5071e973f83c5d6af3fc9b1cbf81297d130f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page