Created
January 4, 2019 12:35
-
-
Save cbrannen9a/24a3f0296a9843463b0ddf321a233a91 to your computer and use it in GitHub Desktop.
Get data from Firestore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase_admin | |
import google.cloud | |
from firebase_admin import credentials, firestore | |
cred = credentials.Certificate("./ServiceAccountKey.json") | |
app = firebase_admin.initialize_app(cred) | |
store = firestore.client() | |
doc_ref = store.collection(u'users').limit(2) | |
try: | |
docs = doc_ref.get() | |
for doc in docs: | |
print(u'Doc Data:{}'.format(doc.to_dict())) | |
except google.cloud.exceptions.NotFound: | |
print(u'Missing data') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment