Quickstart using a server client library
먼저 키 생성:
Firebase concole > settings 아이콘 > service account > 새 비공개키 생성 > xxx.json is downloaded
install firestore module
// note that pip is the same with pip3
$ pip install virtualenv
$ virtualenv env
$ source env/bin/activate
(env) $ pip install --upgrade google-cloud-firestore
(env) $ export GOOGLE_APPLICATION_CREDENTIALS="xxx.json"
(env) $ vi test.py
from google.cloud import firestore
# The `project` parameter is optional and represents which project the client
# will act on behalf of. If not supplied, the client falls back to the default
# project inferred from the environment.
db = firestore.Client(project='readwrite-de55f')
doc_ref = db.collection("caches").document("testfromPythonClient")
doc_ref.set({"first": "Ada", "last": "Lovelace", "born": 1815})
(env) $ python test.py