Spaces:
Running
Running
Download firestore_client.py from yoursdvniel/SmartInc-API: direct link, hf CLI and curl.
- Browser
- Download file 324 Bytes
-
https://huggingface.co/spaces/yoursdvniel/SmartInc-API/resolve/main/firestore_client.py
- Command line
-
hf download hf://spaces/yoursdvniel/SmartInc-API/firestore_client.py
-
curl -L -o firestore_client.py https://huggingface.co/spaces/yoursdvniel/SmartInc-API/resolve/main/firestore_client.py
324 Bytes
| 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) | |