Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
14e3790
Prefer `python -m pip`
n8henrie Sep 1, 2021
87d357a
Update python versions
n8henrie May 14, 2022
bb34763
Try cibuildwheel
n8henrie May 14, 2022
fdfad08
Revert "Try cibuildwheel"
n8henrie May 22, 2022
6e90061
Update black
n8henrie May 22, 2022
8774c1a
Configure RTD
n8henrie Jun 20, 2022
ca957a4
Add support for Brave cookies.
chrisgavin Dec 16, 2022
68b1ffc
Fix line-too-long linting error.
chrisgavin Dec 20, 2022
d2e899e
Add an integration test covering Brave browser.
chrisgavin Dec 20, 2022
c41b234
Merge pull request #40 from chrisgavin/brave
n8henrie Dec 24, 2022
32bc09f
Dependency updates, migrate setup.cfg to pyproject.toml
n8henrie Jan 12, 2023
b641407
Add support for cookies stored by Slack app.
hraftery Apr 27, 2022
3302ea5
Add support for App Store Slack
hraftery Jan 29, 2023
7adf8c6
Add tests, make linter happy
hraftery Jan 29, 2023
d3fe952
Add patreon
n8henrie Feb 4, 2023
00a0e36
Merge pull request #41 from hraftery/support-slack-app-cookies
n8henrie Mar 18, 2023
5d0ecda
Revert "Support Slack app cookies"
n8henrie Mar 18, 2023
67f5faa
Merge pull request #42 from n8henrie/revert-41-support-slack-app-cookies
n8henrie Mar 18, 2023
a837f36
Merge branch 'support-slack-app-cookies' into dev
n8henrie Mar 18, 2023
42cfa5a
black
n8henrie Mar 18, 2023
3507cfe
Test on 3.10 and 3.11
n8henrie Mar 18, 2023
752c391
Merge tests
n8henrie Mar 18, 2023
e846c5b
Fail early on bad scheme
n8henrie Mar 19, 2023
fea3fa8
Mention Brave
n8henrie Mar 21, 2023
b8c8728
Use title case, DRY cookie_file lookups, fix tests
n8henrie Mar 21, 2023
ed2dacb
Update for new contributions
n8henrie Mar 24, 2023
fb6f1f1
Merge branch 'dev'
n8henrie Mar 24, 2023
1e0e64e
Fix missing imports
n8henrie Mar 24, 2023
0c219fc
Import from the module
n8henrie Mar 24, 2023
6af8325
Make mypy happy in CI
n8henrie Mar 24, 2023
734e048
Fix wrong default in readme
n8henrie May 27, 2023
8d1ae10
Bump cryptography from 3.4.6 to 39.0.1
dependabot[bot] Mar 24, 2023
7f3c227
Add Firefox support via firefox_cookies()
grandchild Jul 2, 2023
2187a02
Add Firefox install to tox.ini
grandchild Jul 2, 2023
fae6cad
Rename pycookiecheat.py to chrome.py
grandchild Jul 2, 2023
632fd34
Add "firefox" & "cookies" to project keywords
grandchild Jul 2, 2023
6105051
Move `generate_host_keys` to new "common" module
grandchild Jul 2, 2023
e68e9c5
Add common Cookie dataclass
grandchild Jul 2, 2023
1f1ff88
Add unit tests for pycookiecheat/common
grandchild Jul 7, 2023
f135af4
Typing: Remove unused ignore in chrome.py
grandchild Jul 22, 2023
7b98488
Docstrings: Fix typos and language
grandchild Jul 23, 2023
f2a0bae
Update cryptography
n8henrie Sep 22, 2023
51e3630
v0.6.0
n8henrie Sep 22, 2023
77a176d
Loosen dependency restrictions to facilitate flake.nix
n8henrie Oct 1, 2023
388f91c
Add experimental nix flake
n8henrie Oct 1, 2023
b4a0127
format = "pyproject"; is deprecated
n8henrie Oct 1, 2023
85c3645
Fix inputs and shell
n8henrie Oct 1, 2023
f9ff6e1
Bump cryptography from 41.0.4 to 41.0.6
dependabot[bot] Nov 28, 2023
15511eb
Merge pull request #57 from n8henrie/dependabot/pip/cryptography-41.0.6
n8henrie Nov 28, 2023
815a692
Update Slack keychain identifier.
hraftery Dec 28, 2023
a8d5bce
Merge branch 'dev' into support-slack-app-cookies
n8henrie Dec 28, 2023
e4b765f
Merge pull request #61 from hraftery/support-slack-app-cookies
n8henrie Dec 28, 2023
531747d
Use 3.12
n8henrie Jan 5, 2024
46a115a
Update CI dependencies
n8henrie Jan 5, 2024
7d953f0
Add python37
n8henrie Dec 29, 2023
6c4bb46
Add additional pythons to devenv for testing
n8henrie Dec 29, 2023
0515888
Update inputs
n8henrie Dec 29, 2023
52f58fb
Provide an enum to ensure browser variants
n8henrie Dec 29, 2023
be3d73d
Simplify default browser
n8henrie Dec 29, 2023
089face
Add enum support for Firefox
n8henrie Dec 29, 2023
c5a1ff1
OSX -> MacOS
n8henrie Dec 29, 2023
f5d905f
Top-level export for BrowserType, import from top-level when available
n8henrie Dec 29, 2023
4fa24b9
Update README to show enum usage
n8henrie Dec 29, 2023
42889c8
Convert to str
n8henrie Dec 29, 2023
53f60c4
Remove unused import
n8henrie Dec 29, 2023
5bd86f7
Make `deprecation_warning` non-private as it's being exported across
n8henrie Dec 29, 2023
4b074ef
Update mypy
n8henrie Dec 29, 2023
dc8a481
Invalid browser should now be caught at the type level
n8henrie Dec 29, 2023
49d8c56
mypy fixes
n8henrie Dec 29, 2023
20c93fd
Loosen mypy version
n8henrie Dec 29, 2023
34aa93c
mypy fixes
n8henrie Dec 30, 2023
04636ea
Pin to the last available mypy for 3.7
n8henrie Dec 30, 2023
d8d4e2d
Raise a helpful message for bad BrowserType invariants
n8henrie Jan 2, 2024
de7d609
More OSX -> MacOS
n8henrie Jan 2, 2024
e1aad49
Compare enums by identity
n8henrie Jan 2, 2024
4c06da3
Use f-string
n8henrie Jan 2, 2024
40cd881
Use enum invariant directly
n8henrie Jan 2, 2024
7152de6
Lint
n8henrie Jan 2, 2024
6403b16
mypy
n8henrie Jan 2, 2024
56ea81a
More places to include 3.12
n8henrie Jan 5, 2024
69bd1f6
Update deps for 3.12
n8henrie Jan 5, 2024
17a24ca
Remove 3.7 support
n8henrie Jan 5, 2024
c0a2c77
Add note about supported python versions
n8henrie Jan 5, 2024
5f3d3a6
Add @grandchild to authors
n8henrie Jan 5, 2024
b8c3580
Update additional deps in CI
n8henrie Jan 5, 2024
af39bcf
typo
n8henrie Jan 5, 2024
7b607e6
Update changelog
n8henrie Jan 5, 2024
f83e72d
Update tox
n8henrie Jan 5, 2024
0a611ad
Update dependencies
n8henrie Jan 5, 2024
94ff327
Upgrade cryptography dependency to resolve vulnerabilities
sudowork Apr 29, 2024
ee13b9f
Merge pull request #63 from sudowork/sudowork/cryptography
n8henrie Apr 30, 2024
b328c0a
Add basic logging
n8henrie May 12, 2024
720395f
Merge branch 'issue_46' into dev
n8henrie May 12, 2024
4a7f5f3
Remove leading slash
n8henrie May 12, 2024
7177325
Add command-line tool
n8henrie May 13, 2024
365dc59
Use full link
n8henrie May 13, 2024
5a023b5
Add liberapay
n8henrie May 13, 2024
b46fb82
Provide a pathway to return list[Cookie] instead of just dict
n8henrie May 13, 2024
c3b47ae
linting / typing / formatting
n8henrie May 13, 2024
ac0c817
Use `import typing as t` convetion
n8henrie May 13, 2024
77944bd
Curl cookie file now includes netscape header
n8henrie May 13, 2024
a6439cb
Update brave installation process
n8henrie May 13, 2024
323328b
Import future annotations for python 3.8
n8henrie May 13, 2024
729cba9
Configure logging verbosity from CLI
n8henrie May 13, 2024
4eb2aa6
Import future annotations for python3.8
n8henrie May 13, 2024
3abd498
lint / cleanup
n8henrie May 13, 2024
a469459
Loosen dependency constraints
n8henrie May 13, 2024
78b1479
Add cffi to allow `nix develop -c tox`
n8henrie May 14, 2024
945dcd8
format
n8henrie May 14, 2024
d7f9995
Update dependencies
n8henrie May 14, 2024
d61875d
Stylistic updates
n8henrie May 14, 2024
1cceb50
black
n8henrie May 14, 2024
f84a5b2
Revert "black"
n8henrie May 14, 2024
3893822
Lint for 3.8
n8henrie May 14, 2024
efbd564
Enum wasn't giving the expected name with `str`
n8henrie May 19, 2024
42941d9
v0.7.0
n8henrie May 15, 2024
4c7ea66
Remove shortlink
n8henrie May 19, 2024
cbfe5a6
Fix linkrot
n8henrie May 28, 2024
ab4937f
send dependabot updates to dev branch
n8henrie Jun 1, 2024
0faa4ee
Removed teh Profile directory from the Firefox root dir
MattMuffin Aug 16, 2024
ce2e74b
Updated keyring username for Slack.
hraftery Sep 5, 2024
b48c134
Merge pull request #69 from hraftery/master
n8henrie Sep 5, 2024
79dc09e
Fix handling of cookies in Chromium cookie database versions >=24.
chrisgavin Oct 23, 2024
c105fdb
Handle non-UTF8 sequences in encrypted cookie values.
chrisgavin Oct 23, 2024
5ee5527
Wrap some long lines.
chrisgavin Oct 23, 2024
ead2b75
Add a link to the Chromium source code explaining the version 24 format.
chrisgavin Oct 23, 2024
a01f3f5
Handle missing meta table and version in the cookie database.
chrisgavin Oct 23, 2024
34c5a28
Remove an unused variable.
chrisgavin Oct 23, 2024
4028b20
Run black.
chrisgavin Oct 23, 2024
450a4b1
Add command line option to set cookie file
samiam Oct 27, 2024
6e0d130
Update README with new option
samiam Oct 27, 2024
f7d9f14
Add command line option --version
samiam Oct 27, 2024
54822c8
In help always list short option before long option
samiam Oct 27, 2024
0b67a14
cleanup
n8henrie Oct 31, 2024
fcd5109
Fix tests for new firefox directory on macos
n8henrie Oct 31, 2024
c8f77bf
Fix path to firefox profile directory
n8henrie Oct 31, 2024
94d787d
Handle v24 cookies for chrome
n8henrie Oct 31, 2024
6cd3127
Join URL on one line, skip lints for this line
n8henrie Oct 31, 2024
7a120d6
black
n8henrie Oct 31, 2024
de55ff1
Add flag to show version
n8henrie Oct 31, 2024
7deb9ae
Multiple contributions from users -- thank you!
n8henrie Oct 31, 2024
88b411f
drop py38 add py313
n8henrie Oct 31, 2024
864a9d1
Add ability to supply custom path to cookie file
n8henrie Oct 31, 2024
ce1bc58
lint
n8henrie Nov 1, 2024
3234ed4
Use ruff instead of black + flake + a dozen plugins
n8henrie Nov 1, 2024
7d5271d
Log an exception when cookie file isn't found
n8henrie Nov 1, 2024
8f3b0e5
Pass a specified cookie_file to Firefox
n8henrie Nov 1, 2024
bbe5ba5
lint
n8henrie Nov 1, 2024
baecadd
Get rid of `dev` branch, just use master
n8henrie Nov 1, 2024
ef3a94b
remove no-longer used lib
n8henrie Nov 1, 2024
5d152f7
Update inputs, use py312
n8henrie Nov 2, 2024
f2e3009
Update cryptography to v43
n8henrie Nov 2, 2024
252ca34
Make `url` a positional arg
n8henrie Nov 2, 2024
39d8e44
format
n8henrie Nov 2, 2024
72e37bd
Use f-string for readability
n8henrie Nov 2, 2024
6254b67
Assume `https://` for scheme if not specified
n8henrie Nov 2, 2024
49bf831
py38 -> py313 for tox
n8henrie Nov 2, 2024
646a66c
format
n8henrie Nov 2, 2024
481faaa
fix imports
n8henrie Nov 2, 2024
2ba90e0
format
n8henrie Nov 2, 2024
26c5fa4
Remove deprecated support for specifying browser as a string
n8henrie Nov 2, 2024
efbef3e
Force an error early if an (unrecognized) string is passed
n8henrie Nov 2, 2024
066b9d9
Remove unused import
n8henrie Nov 2, 2024
6b9ae78
Update changelog and README for 0.8
n8henrie Nov 2, 2024
a536427
Refactor cli into separate function for testability
n8henrie Nov 3, 2024
6996e7d
Parse browser name as `BrowserType` at argparse time
n8henrie Nov 3, 2024
3795ea1
Add new top-level `get_cookies`
n8henrie Nov 3, 2024
1fd03c8
Configure ruff, drop config for black / other linting tools
n8henrie Nov 3, 2024
c82fb29
Refactor CLI to separate function for testing
n8henrie Nov 3, 2024
6e02cb8
cleanup
n8henrie Nov 3, 2024
8a6e084
mypy
n8henrie Nov 3, 2024
ae731e3
v0.8.0
n8henrie Nov 2, 2024
278a3cd
Default to last Firefox install if multiple
DukeSliver Jan 4, 2025
36f7208
Restore non-App Store support for Slack
hraftery Jun 18, 2025
fe0d689
Merge pull request #80 from hraftery/master
n8henrie Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

github: [n8henrie]
custom: ["https://n8henrie.com/donate"]
patreon: # Replace with a single Patreon username
patreon: n8henrie
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
liberapay: n8henrie
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@



## [WHYT](http://mattgemmell.com/what-have-you-tried)
## [WHYT](https://web.archive.org/web/20140712194323/http://mattgemmell.com/what-have-you-tried/)



Expand Down
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 2
47 changes: 29 additions & 18 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,51 @@ name: Python package

on:
push:
branches: [ master, dev ]
branches: [ master ]
pull_request:
branches: [ master, dev ]
branches: [ master ]

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

env:
TOX_TESTENV_PASSENV: "XAUTHORITY DISPLAY"
TOX_OVERRIDE: "testenv.pass_env+=XAUTHORITY,DISPLAY,TEST_BROWSER_NAME,TEST_BROWSER_PATH"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
cache: 'pip'
- name: Install tox
run: python -m pip install "tox>=3,<4"
- name: Run tests via tox
run: python -m pip install .[test]
- name: Install Brave
# https://brave.com/linux/#release-channel-installation
run: |
sudo apt-get update
sudo apt-get install -y apt-transport-https curl
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" |
sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt-get update
sudo apt-get install --yes brave-browser
- name: Run tests via tox (Chromium)
run: xvfb-run -- python -m tox -e py
- name: Run tests via tox (Brave)
env:
TEST_BROWSER_NAME: Brave
TEST_BROWSER_PATH: /usr/bin/brave-browser
run: xvfb-run -- python -m tox -e py
- if: "matrix.python-version == '3.9'"
- if: "matrix.python-version == '3.12'"
name: Lint
run: python -m tox -e lint
9 changes: 5 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel twine
python -m pip install .[dev]
- name: Build and publish
env:
TWINE_USERNAME: __token__
Expand Down
8 changes: 5 additions & 3 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
3.9.5
3.8.7
3.7.10
3.11.0
3.10.7
3.9.13
3.8.13
3.7.13
19 changes: 18 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
---

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py

python:
version: 3.7
install:
- method: pip
path: .
9 changes: 4 additions & 5 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Credits

## Development Lead
## Core Contributors

- [Nathan Henrie](http://n8henrie.com) <nate@n8henrie.com>
- [jakob](https://github.com/grandchild) <grandchild@mailbox.org>

## Contributors
## Other Contributors

- [Kostis Anagnostopoulos](https://github.com/ankostis)
- [Dani García](https://github.com/dani14-96)
- [Thinh Nguyen](https://github.com/Taik)
- <https://github.com/n8henrie/pycookiecheat/graphs/contributors>
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# [Changelog](https://keepachangelog.com)

## v0.8.0 :: 20241102

### Breaking Changes

- `url` is now a positional argument (no longer requires `-u`)
- Browser type must be passed as a variant of the `BrowserType` enum; string
is no longer supported
- Now requires python >= 3.9

### CLI Enhancements

- Assume `https://` if the scheme is not specified
- Add `--version` flag (thanks @samiam)
- Add `-c` flag to specify custom path to cookie file (thanks @samiam)
- Convert the `browser` argument into a `BrowserType` at parse time

### Fixes / Other

- Fix new path to Firefox profile on MacOS (thanks @MattMuffin)
- Support Chrome's new v24 cookies (thanks @chrisgavin)
- Add new top-level `get_cookies` function that can be used for all supported
browsers
- No longer need to use separate `chrome_cookies` or `firefox_cookies`
functions, but will leave these around for backwards compatibility
- Use `ruff` instead of hodgepodge of `flake8` / `pycodestyle` / `black` and
others

## v0.7.0 :: 20240105

- Now requires python >= 3.8
- 3.7 is now EoL: https://devguide.python.org/versions/
- pycookiecheat seems to build and run on 3.7, but several test
dependencies require versions that are either incompatible with 3.12 or
3.7
- Add `BrowserType` enum
- Instead of passing a string (e.g. "chrome"), please import and use a
`BrowserType` (e.g. `BrowserType.CHROME`)
- Add deprecation warning for passing strings
- Added a nix flake to facilitate testing multiple python versions
- Add basic logging
- Add CLI tool
- Add `as_cookies` parameter to allow returning `list[Cookie]` instead of
`dict` (without breaking backward compatibility)
- Loosen dependency constrains, which should make usage as a library easier

## v0.6.0 :: 20230324

- Add firefox support, thanks to @grandchild
- Also would like to welcome @grandchild as a new member of the
pycookiecheat team!

## v0.5.0 :: 20230324

- Add support for Brave thanks to @chrisgavin!
- Add support for Slack thanks to @hraftery!
- Migrate config to pyproject.toml alone
- Minor cleanup to codebase and tests

## v0.4.7 :: 20210826

- No noteworthy API changes, hence the bugfix version bump, but some major
Expand Down
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ for local development.
$ git clone git@github.com:your_name_here/pycookiecheat.git
$ cd pycookiecheat

1. Check out the `dev` branch, where development happens prior to being merged
into `master`. Your changes should be based on the `dev` branch, and your PR
should eventually be requested against my `dev` branch.

$ git checkout dev

1. Install your local copy into a virtualenv (`venv` in modern python). Some
linux distributions will require you to install `python-venv` or
`python3-venv`, other times it will already be bundled with python. There
Expand Down Expand Up @@ -96,7 +90,7 @@ for local development.
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

1. Submit a pull request through the GitHub website against my `dev` branch.
1. Submit a pull request through the GitHub website against the `master` branch.

Pull Request Guidelines
-----------------------
Expand Down
69 changes: 54 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ status](https://github.com/n8henrie/pycookiecheat/actions/workflows/python-packa
Borrow cookies from your browser's authenticated session for use in Python
scripts.

- Free software: MIT
- Documentation: http://n8h.me/HufI1w
- Free software: MIT
- [Documentation](https://n8henrie.com/2013/11/use-chromes-cookies-for-easier-downloading-with-python-requests/)

## Installation

**NB:** Use `pip` and `python` instead of `pip3` and `python3` if 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+.
Python 3 and in general will aim to support python versions that are stable and
not yet end-of-life: <https://devguide.python.org/versions>.

- `python3 -m pip install pycookiecheat`

Expand Down Expand Up @@ -41,28 +42,66 @@ Alternatively, some users have suggested running Chrome with the

## Usage

### As a Command-Line Tool

After installation, the CLI tool can be run as a python module `python -m` or
with a standalone console script:

```console
$ python -m pycookiecheat --help
usage: pycookiecheat [-h] [-b BROWSER] [-o OUTPUT_FILE] [-v] [-c COOKIE_FILE]
[-V]
url

Copy cookies from Chrome or Firefox and output as json

positional arguments:
url

options:
-h, --help show this help message and exit
-b BROWSER, --browser BROWSER
-o OUTPUT_FILE, --output-file OUTPUT_FILE
Output to this file in netscape cookie file format
-v, --verbose Increase logging verbosity (may repeat), default is
`logging.ERROR`
-c COOKIE_FILE, --cookie-file COOKIE_FILE
Cookie file
-V, --version show program's version number and exit

```

By default it prints the cookies to stdout as JSON but can also output a file in
Netscape Cookie File Format.

### As a Python Library

```python
from pycookiecheat import chrome_cookies
from pycookiecheat import BrowserType, get_cookies
import requests

url = 'http://example.com/fake.html'
url = 'https://n8henrie.com'

# Uses Chrome's default cookies filepath by default
cookies = chrome_cookies(url)
cookies = get_cookies(url)
r = requests.get(url, cookies=cookies)

# Using an alternate browser
cookies = get_cookies(url, browser=BrowserType.CHROMIUM)
```

Use the `cookie_file` keyword-argument to specify a different filepath for the
cookies-file: `chrome_cookies(url, cookie_file='/abspath/to/cookies')`
Use the `cookie_file` keyword-argument to specify a different path to the file
containing your cookies:
`get_cookies(url, cookie_file='/abspath/to/cookies')`

Keep in mind that pycookiecheat defaults to looking for cookies for
Chromium, not Google Chrome, so if you're using the latter, you'll need to
manually specify something like
`"/home/username/.config/google-chrome/Default/Cookies"` as your `cookie_file`.
You may be able to retrieve cookies for alternative Chromium-based browsers by
manually specifying something like
`"/home/username/.config/BrowserName/Default/Cookies"` as your `cookie_file`.

## Features

- Returns decrypted cookies from Google Chrome on OSX or Linux.
- Returns decrypted cookies from Google Chrome, Brave, or Slack, on MacOS or
Linux.
- Optionally outputs cookies to file (thanks to Muntashir Al-Islam!)

## FAQ / Troubleshooting
Expand Down Expand Up @@ -93,9 +132,9 @@ libffi-dev python-dev` prior to installing with `pip`.

On KDE, Chrome defaults to using KDE's own keyring, KWallet. For pycookiecheat to support KWallet the [`dbus-python`](https://pypi.org/project/dbus-python/) package must be installed.

### How do I install the dev branch with pip?
### How do I install the (unreleased) master branch with pip?

- `python -m pip install git+https://github.com/n8henrie/pycookiecheat@dev`
- `python -m pip install git+https://github.com/n8henrie/pycookiecheat@master`

## Buy Me a Coffee

Expand Down
4 changes: 4 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MSPV:
- 3.10
- Replace `t.Union` with `|`
- several places that match would work well
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading