bugfix
This commit is contained in:
@@ -1,5 +1,53 @@
|
||||
# (Imports und Konfiguration bleiben wie zuvor)
|
||||
# (Funktion get_services_with_service_account bleibt wie zuvor)
|
||||
import csv
|
||||
from datetime import datetime
|
||||
import collections
|
||||
import os.path
|
||||
|
||||
from google.oauth2 import service_account
|
||||
from googleapiclient.discovery import build
|
||||
from googleapiclient.errors import HttpError
|
||||
|
||||
# --- Konfiguration ---
|
||||
CSV_FILENAME = 'Namensliste.csv'
|
||||
GOOGLE_DOC_TITLE = f"Gruppenlisten Kinderhaus St. Martin Neuching (Service Acc) - {datetime.now().strftime('%Y-%m-%d_%H-%M')}"
|
||||
TARGET_FOLDER_ID = "18DNQaH9zbcBzwhckJI-4Uah-WXTXg6bg"
|
||||
|
||||
EINRICHTUNG = "Kinderhaus St. Martin Neuching"
|
||||
FOTODATUM = "02. - 05.06.2025"
|
||||
GRUPPENNAME_SUFFIX = "gruppe"
|
||||
|
||||
FOTOGRAF_NAME = "Kinderfotos Erding"
|
||||
FOTOGRAF_ADRESSE = "Gartenstr. 10 85445 Oberding"
|
||||
FOTOGRAF_WEB = "www.kinderfotos-erding.de"
|
||||
FOTOGRAF_TEL = "08122-8470867"
|
||||
|
||||
SCOPES = [
|
||||
'https://www.googleapis.com/auth/documents',
|
||||
'https://www.googleapis.com/auth/drive.file'
|
||||
]
|
||||
SERVICE_ACCOUNT_FILE = 'service_account.json'
|
||||
# --- Ende Konfiguration ---
|
||||
|
||||
def get_services_with_service_account():
|
||||
creds = None
|
||||
docs_service = None
|
||||
drive_service = None
|
||||
try:
|
||||
creds = service_account.Credentials.from_service_account_file(
|
||||
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
|
||||
except Exception as e:
|
||||
print(f"Fehler Credentials: {e}"); return None, None
|
||||
try:
|
||||
docs_service = build('docs', 'v1', credentials=creds)
|
||||
print("Google Docs API Service erstellt.")
|
||||
except Exception as e_docs: print(f"Fehler Docs Service: {e_docs}")
|
||||
try:
|
||||
if any(s in SCOPES for s in ['https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/drive']):
|
||||
drive_service = build('drive', 'v3', credentials=creds)
|
||||
print("Google Drive API Service erstellt.")
|
||||
else: print("WARNUNG: Kein Drive Scope für Drive Service.")
|
||||
except Exception as e_drive: print(f"Fehler Drive Service: {e_drive}")
|
||||
return docs_service, drive_service
|
||||
|
||||
def create_and_fill_doc_plain_text(docs_service, drive_service, folder_id, doc_title):
|
||||
# ... (Dokumenterstellung und CSV-Lesen bleiben wie zuvor) ...
|
||||
|
||||
Reference in New Issue
Block a user