import os import json from google.cloud import firestore from google.oauth2 import service_account def get_firestore_client(): creds = json.loads(os.environ['FIREBASE_CREDENTIALS_JSON']) credentials = service_account.Credentials.from_service_account_info(creds) return firestore.Client(credentials=credentials)