Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ Pobrano 5 nowych faktur:
- ...
```

### Nadpisywanie konfiguracji

Możesz podać token i NIP jako parametry, które nadpiszą wartości z `.env`:

```bash
python fetch_invoices.py --token twój-token-ksef --nip 1234567890
```

Parametry:
- `--token` - Token KSeF (nadpisuje `KSEF_TOKEN` z `.env`)
- `--nip` - NIP kontekstu (nadpisuje `CONTEXT_NIP` z `.env`)
- `--format` - Format wyjścia: `json` (domyślny) lub `text`

## Jak działa

1. **Uwierzytelnianie** - używa tokena KSeF
Expand Down
18 changes: 13 additions & 5 deletions fetch_invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,22 @@ def main():
default='json',
help='Format outputu (domyślnie: json)'
)

parser.add_argument(
'--token',
help='Token KSeF (nadpisuje KSEF_TOKEN z .env)'
)
parser.add_argument(
'--nip',
help='NIP kontekstu (nadpisuje CONTEXT_NIP z .env)'
)

args = parser.parse_args()

# Załaduj konfigurację
load_dotenv()
ksef_token = os.getenv('KSEF_TOKEN')
context_nip = os.getenv('CONTEXT_NIP')

ksef_token = args.token or os.getenv('KSEF_TOKEN')
context_nip = args.nip or os.getenv('CONTEXT_NIP')

if not ksef_token or not context_nip:
print(json.dumps({
Expand Down