diff --git a/brancheneinstufung.py b/brancheneinstufung.py index 33ecc578..7d2516e6 100644 --- a/brancheneinstufung.py +++ b/brancheneinstufung.py @@ -29,6 +29,19 @@ from difflib import SequenceMatcher import unicodedata import csv + +def retry_on_failure(func): + def wrapper(*args, **kwargs): + for attempt in range(Config.MAX_RETRIES): + try: + return func(*args, **kwargs) + except Exception as e: + print(f"⚠️ Fehler bei {func.__name__} (Versuch {attempt+1}): {str(e)[:100]}") + time.sleep(Config.RETRY_DELAY) + return None + return wrapper + + # Optional: tiktoken für Token-Zählung (Modus 8) try: import tiktoken