Utility scripts for operations and credit management at Two.
| Folder | Description |
|---|---|
bulk_credit_check/ |
Bulk-check credit decisions and limits for a list of companies against a merchant |
bespoke_credit_limit/ |
Submit bespoke credit limit requests in bulk via the admin API |
bulk_invoice_download/ |
Download invoice or credit note PDFs in bulk and zip them |
See the README in each folder for setup and usage instructions.
All scripts share the same dependencies. From the repo root:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtAll scripts authenticate with your admin session cookie:
- Log in to the Two admin portal
- Open browser DevTools → Application → Cookies
- Copy the value of
two-inc-cookie - Paste it into the
COOKIEvariable at the top (or bottom) of the script
- Never commit real company data. Input/output CSVs are gitignored. Use the
*_template.csvfiles as a reference. - Session cookies expire. If you get 401 errors, refresh your cookie from DevTools.
- Rate limiting. Scripts include a small delay between requests. Increase it if you hit rate limit errors.
- Staging vs production. Double-check
BASE_URL/API_URLbefore running against production.