Log in through a real browser once; graftpunk captures the authenticated session — cookies, browser-fingerprinted headers, CSRF/API tokens — encrypts it at rest, and replays it over plain HTTP from Python or a generated CLI, so a site's own XHR/JSON endpoints become scriptable without a WebDriver in the loop.
The Problem
Plenty of services you have an account with expose no API — an ISP portal, a school or medical portal, a niche shop, a municipal records site. The data is yours and it is one login away, but every request has to look like it came from a browser that already signed in: the right cookies, the browser's own headers, whatever CSRF or bearer token the page minted. Reproducing that by hand for every script is the actual chore.
The Solution
graftpunk does the login in a real browser (yours, or a declaratively scripted one), captures the resulting session and header fingerprint, stores it encrypted, and hands it back as a requests-compatible session — locally, or from S3/Supabase when the same session needs to be shared.
1. LOG IN 2. CACHE 3. SCRIPT
+-------------+ +-------------+ +-------------+
| Browser | | Encrypted | | Python |
| Session |------>| Storage |------>| Script |
| | | | | |
+-------------+ +-------------+ +-------------+
Log in manually Session cached Use the session
or declaratively with AES-128 with real browser
via plugin config encryption headers replayed
Once your session is cached, you can:
- Make HTTP requests with your authenticated cookies and real browser headers
- Reverse-engineer XHR calls from browser dev tools
- Build CLI tools that feel like real APIs
- Automate downloads of documents and data
- Keep sessions alive with background daemons
- Capture network traffic for debugging and auditing
What You Can Build
Each of these is a plugin command backed by the cached session; graftpunk generates the CLI, injects the session and tokens, and formats the output:
# Pull your kid's grades and assignments
gp schoolportal grades --student emma --format table
# Download your medical lab results
gp mychart labs --after 2024-06-01 --output ./results/
# Export your energy usage data
gp utility usage --months 12 --format csv > energy.csv
# Scrape your property tax history
gp county assessor --parcel 12345 --format json
# Make ad-hoc requests with cached session cookies + browser headers
gp http get -s mychart https://mychart.example.com/api/appointments
These aren't real APIs—they're commands defined in graftpunk plugins that replay the same XHR calls the website makes. To the server, it looks like a browser. To you, it's just automation.
Installation
Logging in drives a real browser, so the default install includes the browser
stack (Selenium, undetected-chromedriver, nodriver and their tooling):
pip install graftpunk
pip install 'graftpunk[browser]' still works and installs the same thing; the
extra is kept so existing requirements resolve.
Lite install, no browser:
pip install graftpunk-lite