Skip to content

Instantly share code, notes, and snippets.

@cbrannen9a cbrannen9a/main.py
Created Jan 4, 2019

Embed
What would you like to do?
Get data from Firestore
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
You can’t perform that action at this time.