yoursdvniel commited on
Commit
d1c6cd6
·
verified ·
1 Parent(s): 6484eda

Create firestore_client.py

Browse files
Files changed (1) hide show
  1. firestore_client.py +9 -0
firestore_client.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ from google.cloud import firestore
4
+ from google.oauth2 import service_account
5
+
6
+ def get_firestore_client():
7
+ creds = json.loads(os.environ['FIREBASE_CREDENTIALS_JSON'])
8
+ credentials = service_account.Credentials.from_service_account_info(creds)
9
+ return firestore.Client(credentials=credentials)