Last active
May 19, 2020 12:37
-
-
Save ochilab/f1baf74394ce378c37620b05bebacfc8 to your computer and use it in GitHub Desktop.
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 | |
from firebase_admin import credentials | |
from firebase_admin import firestore | |
import os | |
#環境変数 | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = './firebasekey.json' | |
cred = credentials.Certificate('firebasekey.json') | |
firebase_admin.initialize_app(cred) | |
db = firestore.Client() | |
data = { | |
u"sname":u"lab", | |
u"fname":u"ochi" | |
} | |
db.collection(u'user').document(u"ochilab").set(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment