Files
backblaze-invoices-downloader/README.md
2026-04-05 22:01:50 +02:00

65 lines
1.5 KiB
Markdown

# Backblaze Invoice Downloader
Download Backblaze invoices as PDF using browser automation.
Backblaze only provides invoices via a web page that must be printed — this tool automates that process using Playwright, filling in configurable fields (VAT ID, document type, company, notes) and exporting each invoice to PDF.
## Setup
```bash
pip install -r requirements.txt
playwright install chromium
```
Or with Nix:
```bash
nix develop
```
## Configuration
Create a `.env` file (see `.env.example`):
```env
BACKBLAZE_EMAIL=you@example.com
BACKBLAZE_PASSWORD=your_password
INVOICE_VAT_ID=DE123456789
INVOICE_DOCUMENT_TYPE=Invoice
INVOICE_COMPANY=My Company GmbH
INVOICE_NOTES=Internal ref: 12345
OUTPUT_DIR=./invoices
BROWSER_HEADLESS=true
```
## Usage
```bash
python main.py
```
### Options
```
-o, --output DIR Output directory (default: ./invoices)
--headless Run browser headless
--no-headless Show browser window (useful for debugging)
--vat-id ID VAT ID to fill on invoices
--document-type TYPE Document type to select
--company NAME Company name to fill
--notes TEXT Notes to fill on invoices
-v, --verbose Verbose logging
```
CLI arguments override `.env` values.
## How it works
1. Logs in to `secure.backblaze.com`
2. Navigates to the billing page
3. Iterates over all billing groups and years
4. For each invoice, opens the invoice page, fills the configured fields, and exports to PDF
5. Skips already-downloaded invoices