Files
paase d15c927f55 feat: initial commit for ipv64 DNS TUI client
- Implement modular Textual TUI (main, app, widgets, config, api_client)
- Integrate IPv64.net REST API client using httpx
- Support record listing, creation, in-place edit, and deletion
- Add flexible token resolution (.env, env export, interactive prompt)
- Add bilingual README (DE/EN) and project configuration
2026-09-24 13:51:42 +02:00

43 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""IPv64 DNS TUI Client
Author: Pascal Bouquet <pascal@ptbos.de>
License: GNU General Public License v3.0 (GPL-3.0)
Year: 2026
"""
import os
import sys
from dotenv import load_dotenv
load_dotenv()
ENV_KEY_NAME = "IPV64_API_KEY"
# Standard-Platzhalter, die als "nicht konfiguriert" gewertet werden
PLACEHOLDERS = {
"",
"dein_api_token_hier",
"dein_api_key",
"dein_geheimer_api_schluessel",
"your_api_key_here",
}
def get_api_key() -> str:
token = os.getenv(ENV_KEY_NAME, "").strip()
# Falls der Token leer ist oder noch ein Platzhalter drinsteht
if token.lower() in PLACEHOLDERS:
print("Kein gültiger API-Token gefunden (Platzhalter oder leer).")
try:
token = input("Bitte IPv64 API-Token eingeben: ").strip()
except (KeyboardInterrupt, EOFError):
print("\nAbgebrochen.")
sys.exit(0)
if not token or token.lower() in PLACEHOLDERS:
print("Fehler: Ein gültiger Token ist erforderlich, um fortzufahren.")
sys.exit(1)
return token