aktivvo-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: aktivvo-cli
3
+ Version: 0.1.0
4
+ Summary: CLI client for the Aktivvo / Padam booking API
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: cryptography>=42.0.0
8
+ Requires-Dist: requests>=2.32.0
9
+
10
+ # Aktivvo CLI
11
+
12
+ Kleines Python-CLI, das die Aktivvo-Website nicht per Browser steuert, sondern dieselben Padam-API-Calls wie das Frontend verwendet.
13
+
14
+ ## Wichtige Grenze
15
+
16
+ Die POST-Endpoints sind auf `start.aktivvo.padam.io` durch CrowdSec / reCAPTCHA geschützt. Das Tool umgeht diese Hürde nicht.
17
+
18
+ Praktisch heißt das:
19
+
20
+ 1. Im Browser die Aktivvo-Seite öffnen.
21
+ 2. Falls das CrowdSec / reCAPTCHA erscheint, dort freischalten.
22
+ 3. Falls Buchungen gemacht werden sollen, normal im Browser einloggen.
23
+ 4. Entweder aus den Browser-Devtools den vollständigen `Cookie`-Header für `https://start.aktivvo.padam.io` kopieren oder `login-browser` / `import-cookies` nutzen.
24
+ 5. Diesen Cookie-Header dem CLI übergeben.
25
+
26
+ Wenn der Cookie-Header `authz_pdm=...` enthält, zieht das CLI den Token automatisch daraus und setzt `Authorization: Token ...`. Bei OpenID-Sessions nutzt es `Bearer`.
27
+
28
+ Stand 16. März 2026 ist für diese Deployment-URL kein belastbarer reiner CLI-Username/Password-Login nachweisbar: `POST /api/v1.7/signin` liefert auch mit mobilen Padam-Headern nur `500`, und OpenID ist in der Web-Konfiguration leer. Der praktikable Login für die CLI ist daher ein browsergestützter Session-Import.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ python3 -m venv .venv
34
+ source .venv/bin/activate
35
+ pip install -e .
36
+ ```
37
+
38
+ ## Basisnutzung
39
+
40
+ Cookie einmal in eine Umgebungsvariable legen:
41
+
42
+ ```bash
43
+ export AKTIVVO_COOKIE_HEADER='crowdsec=...; authz_pdm=...'
44
+ ```
45
+
46
+ Oder direkt aus Chrome importieren:
47
+
48
+ ```bash
49
+ eval "$(aktivvo import-cookies --browser chrome --format env)"
50
+ ```
51
+
52
+ Oder den Login direkt aus der CLI anstoßen, Browser öffnen lassen und auf die Session warten:
53
+
54
+ ```bash
55
+ eval "$(aktivvo login-browser --browser chrome --format env)"
56
+ ```
57
+
58
+ Falls schon eine gültige Session im gewählten Browser-Profil liegt, gibt `login-browser` sie sofort zurück. Für einen echten Neu-Login:
59
+
60
+ ```bash
61
+ eval "$(aktivvo login-browser --browser chrome --wait-for-new-token --format env)"
62
+ ```
63
+
64
+ Falls macOS den Keychain-Zugriff blockiert oder hängen bleibt, kann das Safe-Storage-Passwort auch explizit gesetzt werden:
65
+
66
+ ```bash
67
+ AKTIVVO_SAFE_STORAGE_PASSWORD='...' aktivvo import-cookies --browser chrome --format env
68
+ ```
69
+
70
+ Nodes für ein Gebiet anzeigen:
71
+
72
+ ```bash
73
+ aktivvo search-nodes --territory holzwinkel --limit 20
74
+ ```
75
+
76
+ Aktuellen Benutzer prüfen:
77
+
78
+ ```bash
79
+ aktivvo current-customer
80
+ ```
81
+
82
+ Suche auf Basis zweier Node-IDs:
83
+
84
+ ```bash
85
+ aktivvo search \
86
+ --territory holzwinkel \
87
+ --from-id 1055 \
88
+ --to-id 1056 \
89
+ --datetime '2026-03-17T10:00:00+01:00'
90
+ ```
91
+
92
+ Search-Response analysieren:
93
+
94
+ ```bash
95
+ aktivvo inspect-search search-response.json
96
+ ```
97
+
98
+ Direkt aus einer gespeicherten Search-Response buchen:
99
+
100
+ ```bash
101
+ aktivvo book-from-search-response \
102
+ search-response.json \
103
+ --territory holzwinkel \
104
+ --payment-method onboard \
105
+ --customer-id 111 \
106
+ --indications 'Bitte an der Bushaltestelle warten'
107
+ ```
108
+
109
+ Buchung finalisieren:
110
+
111
+ ```bash
112
+ aktivvo book \
113
+ --territory holzwinkel \
114
+ --reservation-history-id 12345 \
115
+ --customer-proposition-id 67890 \
116
+ --payment-method onboard \
117
+ --customer-id 111 \
118
+ --indications 'Bitte an der Bushaltestelle warten'
119
+ ```
120
+
121
+ ## Reverse-Engineerte Payloads
122
+
123
+ Die wichtigsten Payloads sind direkt aus dem Frontend-Bundle abgeleitet:
124
+
125
+ - Suche: `POST /api/v1.7/get-rides-multinode`
126
+ - Finale Buchung: `POST /api/v1.7/validate-booking`
127
+ - Proposition-Validierung: `POST /api/searchrequests/{searchRequestId}/propositions/{propositionId}/validate/`
128
+ - Aktueller Nutzer: `GET /api/customers/current/` mit `Accept: application/json; version=2.0`
129
+ - Cookie-Import: lokales Chromium-Cookie-DB-Parsing auf macOS mit Keychain-Entschlüsselung
130
+
131
+ Die CLI ist absichtlich roh gehalten und gibt JSON aus, damit man Responses zuerst inspizieren und danach gezielt weitere Calls bauen kann.
@@ -0,0 +1,122 @@
1
+ # Aktivvo CLI
2
+
3
+ Kleines Python-CLI, das die Aktivvo-Website nicht per Browser steuert, sondern dieselben Padam-API-Calls wie das Frontend verwendet.
4
+
5
+ ## Wichtige Grenze
6
+
7
+ Die POST-Endpoints sind auf `start.aktivvo.padam.io` durch CrowdSec / reCAPTCHA geschützt. Das Tool umgeht diese Hürde nicht.
8
+
9
+ Praktisch heißt das:
10
+
11
+ 1. Im Browser die Aktivvo-Seite öffnen.
12
+ 2. Falls das CrowdSec / reCAPTCHA erscheint, dort freischalten.
13
+ 3. Falls Buchungen gemacht werden sollen, normal im Browser einloggen.
14
+ 4. Entweder aus den Browser-Devtools den vollständigen `Cookie`-Header für `https://start.aktivvo.padam.io` kopieren oder `login-browser` / `import-cookies` nutzen.
15
+ 5. Diesen Cookie-Header dem CLI übergeben.
16
+
17
+ Wenn der Cookie-Header `authz_pdm=...` enthält, zieht das CLI den Token automatisch daraus und setzt `Authorization: Token ...`. Bei OpenID-Sessions nutzt es `Bearer`.
18
+
19
+ Stand 16. März 2026 ist für diese Deployment-URL kein belastbarer reiner CLI-Username/Password-Login nachweisbar: `POST /api/v1.7/signin` liefert auch mit mobilen Padam-Headern nur `500`, und OpenID ist in der Web-Konfiguration leer. Der praktikable Login für die CLI ist daher ein browsergestützter Session-Import.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ python3 -m venv .venv
25
+ source .venv/bin/activate
26
+ pip install -e .
27
+ ```
28
+
29
+ ## Basisnutzung
30
+
31
+ Cookie einmal in eine Umgebungsvariable legen:
32
+
33
+ ```bash
34
+ export AKTIVVO_COOKIE_HEADER='crowdsec=...; authz_pdm=...'
35
+ ```
36
+
37
+ Oder direkt aus Chrome importieren:
38
+
39
+ ```bash
40
+ eval "$(aktivvo import-cookies --browser chrome --format env)"
41
+ ```
42
+
43
+ Oder den Login direkt aus der CLI anstoßen, Browser öffnen lassen und auf die Session warten:
44
+
45
+ ```bash
46
+ eval "$(aktivvo login-browser --browser chrome --format env)"
47
+ ```
48
+
49
+ Falls schon eine gültige Session im gewählten Browser-Profil liegt, gibt `login-browser` sie sofort zurück. Für einen echten Neu-Login:
50
+
51
+ ```bash
52
+ eval "$(aktivvo login-browser --browser chrome --wait-for-new-token --format env)"
53
+ ```
54
+
55
+ Falls macOS den Keychain-Zugriff blockiert oder hängen bleibt, kann das Safe-Storage-Passwort auch explizit gesetzt werden:
56
+
57
+ ```bash
58
+ AKTIVVO_SAFE_STORAGE_PASSWORD='...' aktivvo import-cookies --browser chrome --format env
59
+ ```
60
+
61
+ Nodes für ein Gebiet anzeigen:
62
+
63
+ ```bash
64
+ aktivvo search-nodes --territory holzwinkel --limit 20
65
+ ```
66
+
67
+ Aktuellen Benutzer prüfen:
68
+
69
+ ```bash
70
+ aktivvo current-customer
71
+ ```
72
+
73
+ Suche auf Basis zweier Node-IDs:
74
+
75
+ ```bash
76
+ aktivvo search \
77
+ --territory holzwinkel \
78
+ --from-id 1055 \
79
+ --to-id 1056 \
80
+ --datetime '2026-03-17T10:00:00+01:00'
81
+ ```
82
+
83
+ Search-Response analysieren:
84
+
85
+ ```bash
86
+ aktivvo inspect-search search-response.json
87
+ ```
88
+
89
+ Direkt aus einer gespeicherten Search-Response buchen:
90
+
91
+ ```bash
92
+ aktivvo book-from-search-response \
93
+ search-response.json \
94
+ --territory holzwinkel \
95
+ --payment-method onboard \
96
+ --customer-id 111 \
97
+ --indications 'Bitte an der Bushaltestelle warten'
98
+ ```
99
+
100
+ Buchung finalisieren:
101
+
102
+ ```bash
103
+ aktivvo book \
104
+ --territory holzwinkel \
105
+ --reservation-history-id 12345 \
106
+ --customer-proposition-id 67890 \
107
+ --payment-method onboard \
108
+ --customer-id 111 \
109
+ --indications 'Bitte an der Bushaltestelle warten'
110
+ ```
111
+
112
+ ## Reverse-Engineerte Payloads
113
+
114
+ Die wichtigsten Payloads sind direkt aus dem Frontend-Bundle abgeleitet:
115
+
116
+ - Suche: `POST /api/v1.7/get-rides-multinode`
117
+ - Finale Buchung: `POST /api/v1.7/validate-booking`
118
+ - Proposition-Validierung: `POST /api/searchrequests/{searchRequestId}/propositions/{propositionId}/validate/`
119
+ - Aktueller Nutzer: `GET /api/customers/current/` mit `Accept: application/json; version=2.0`
120
+ - Cookie-Import: lokales Chromium-Cookie-DB-Parsing auf macOS mit Keychain-Entschlüsselung
121
+
122
+ Die CLI ist absichtlich roh gehalten und gibt JSON aus, damit man Responses zuerst inspizieren und danach gezielt weitere Calls bauen kann.
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aktivvo-cli"
7
+ version = "0.1.0"
8
+ description = "CLI client for the Aktivvo / Padam booking API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "cryptography>=42.0.0",
13
+ "requests>=2.32.0",
14
+ ]
15
+
16
+ [project.scripts]
17
+ aktivvo = "aktivvo_cli.cli:main"
18
+
19
+ [tool.setuptools]
20
+ package-dir = {"" = "src"}
21
+
22
+ [tool.setuptools.packages.find]
23
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ __all__ = ["__version__"]
2
+
3
+ __version__ = "0.1.0"