Skip to content

Instantly share code, notes, and snippets.

@ochilab
Created March 30, 2020 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochilab/ad69767831f73b1d7d8f77fbca8aef48 to your computer and use it in GitHub Desktop.
Save ochilab/ad69767831f73b1d7d8f77fbca8aef48 to your computer and use it in GitHub Desktop.
PythonでFirebaseを用いる際のサービスアカウント情報の設定
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
import os
#環境変数
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = './xxxxx-credentials.json'
#credentialsの読み込み
cred = credentials.Certificate('xxxxx-credentials.json')
firebase_admin.initialize_app(cred)
db = firestore.Client()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment