File size: 324 Bytes
d1c6cd6
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
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)