Package: pycookiecheat
pycookiecheatBorrow cookies from your browser's authenticated session for use in Python
scripts.Free software: MITDocumentation:http://n8h.me/HufI1wInstallationNB:Usepipandpythoninstead ofpip3andpython3if you're still
on Python 2 and using pycookiecheat < v0.4.0. pycookiecheat >= v0.4.0 requires
Python 3.5+, and may soon go to 3.6+.python3 -m pip install pycookiecheatInstallation notes regarding alternative keyrings on LinuxSee#12. Chrome is now
using a few different keyrings to store yourChrome Safe Storagepassword,
instead of a hard-coded password. Pycookiecheat doesn't work with most of these
so far, and to be honest my enthusiasm for adding support for ones I don't use
is limited. However, users have contributed code that seems to work with some
of the recent Ubuntu desktops. To get it working, you may have tosudo apt-get install libsecret-1-dev python-gi python3-gi, and if you're installing into a
virtualenv (highly recommended), you need to use the--system-site-packagesflag to get access to the necessary libraries.Alternatively, some users have suggested running Chrome with the--password-store=basicor--use-mock-keychainflags.Development Setupgit clone https://github.com/n8henrie/pycookiecheat.gitcd pycookiecheatpython3 -m venv .venv./.venv/bin/python -m pip install -e .[dev]Usagefrompycookiecheatimportchrome_cookiesimportrequestsurl='http://example.com/fake.html'# Uses Chrome's default cookies filepath by defaultcookies=chrome_cookies(url)r=requests.get(url,cookies=cookies)Use thecookie_filekeyword-argument to specify a different filepath for the
cookies-file:chrome_cookies(url, cookie_file='/abspath/to/cookies')Keep in mind that pycookiecheat defaults to looking for cookies for Google
Chrome, not Chromium, so if you're using the latter, you'll need to manually
specify something like"/home/username/.config/chromium/Default/Cookies"(for
Linux) as yourcookie_file.FeaturesReturns decrypted cookies from Google Chrome, Brave, or Slack, on OSX or
Linux.Optionally outputs cookies to file (thanks to Muntashir Al-Islam!)FAQ / TroubleshootingHow about Windows?I don't use Windows or have a PC, so I won't be adding support myself. Feel
free to make a PR :)I get an installation error with thecryptographymodule on OS X(pycookiecheat <v0.4.0)If you're gettingthis
errorand using Homebrew, then you need to follow the instructions forBuilding
cryptography on OS
Xandexport LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include"and try again.I get an installation error with thecryptographymodule on LinuxPlease check the official cryptography docs. On some systems (e.g. Ubuntu), you
may need to do something likesudo apt-get install build-essential libssl-dev libffi-dev python-devprior to installing withpip.How can I use pycookiecheat on KDE-based Linux distros?On KDE, Chrome defaults to using KDE's own keyring, KWallet. For pycookiecheat to support KWallet thedbus-pythonpackage must be installed.How do I install the dev branch with pip?python -m pip install git+https://github.com/n8henrie/pycookiecheat@devBuy Me a Coffee☕️Changelogv0.6.0 :: 20230324Add firefox support , thanks to @grandchildAlso would like to welcome @grandchild as a new member of the
pycookiecheat team!v0.5.0 :: 20230324Add support for Brave thanks to @chrisgavin!Add support for Slack thanks to @hraftery!Migrate config to pyproject.toml aloneMinor cleanup to codebase and testsv0.4.7 :: 20210826No noteworthy API changes, hence the bugfix version bump, but some major
infrastructure and testing updates:Now uses GitHub Actions instead of TravisNow uses Playwright for testing, to actually open a Chromium instance and
use a realCookiesdatabasePEP517blackNow requires python >= 3.7This is largely due to requiremets of Playwright:https://pypi.org/project/playwright/, which is only atestdependencyBecause I can'ttestwith <=3.6, I'm not listing it as compatible,
though itprobablywill still workMigrate to pyproject.tomlv0.4.6 :: 2019111Try to open Chrome database in read-only mode to avoid db locked errors (#29)v0.4.5 :: 20191007db6ac6d Go back to using cryptography due tohttps://www.cvedetails.com/cve/CVE-2013-7459/c70ad51 Allow users to override password (thanks @alairock)v0.4.4 :: 20180706Optionally outputs cookies to a file compatible with cURL (thanks to
Muntashir Al-Islam!)v0.4.3 :: 20170627Consistently use Chrome as default across platforms, allow user to specify
Chromium as desired (thanks @jtbraun)v0.4.0 :: 20170504Remove compatibility for Python <3.5Add type hintsRefactor for smaller functionsExpand docstringsRevert fromcryptographyback toPyCryptoandhashlibfor easier
installation.v0.3.4 :: 20170414Add support for new Ubuntu keyring / libsecretSeehttps://github.com/n8henrie/pycookiecheat/issues/12for detailsMany thanks to @stat1c1c3au and @trideceth12 for contributions0.3.0Usecryptographyinstead ofpycrypto(thanks toTaik!)Seems to besignificantly
fasterWorks with PyPy >= 2.6.0 (no support for PyPy3 yet)0.2.0Fix domain and subdomain matchingMake SQL query more secure by avoiding string formattingMany thanks toBrandon Rhodesfor 24c4234 !0.1.10Read version to separate file so it can be imported in setup.pyBugfix for python2 on linux0.1.9Bugfix for python2 on linux0.1.8Python2 support (thanksdani14-96)0.1.7Configurable cookies file (thanksankostis)0.1.6OSError instead of Exception for wrong OS.Moved testing requirements to tox and travis-ci files.0.1.5Updated to work better with PyPI's lack of markdown supportWorking on tox and travis-ci integrationAdded a few basic tests that should pass if one has Chrome installed and has visited my site (n8henrie.com)Added sys.exit(0) if cookie_file not found so tests pass on travis-ci.0.1.0 (2015-02-25)First release on PyPI.Prior changelog from Gist20150221 v2.0.1: Now should find cookies for base domain and all subs.20140518 v2.0: Now works with Chrome's new encrypted cookies.