-
Notifications
You must be signed in to change notification settings - Fork 0
/
Retrive.py
61 lines (31 loc) · 968 Bytes
/
Retrive.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import firebase_admin
from firebase_admin import credentials, firestore, db
#from firebase_admin import credentials
import os
#os.chdir('/home/heisenberg/UwinEmotions')
private_key_name = 'uwinemotions-firebase-adminsdk-y223w-53aacd7b6b.json'
cred = credentials.Certificate(private_key_name)
firebase_admin.initialize_app(cred, {'databaseURL': 'https://uwinemotions.firebaseio.com'})
# In[6]:
db = firestore.client()
doc_ref = db.collection('locations').document('1')
doc = doc_ref.get()
if doc.exists:
location = doc.to_dict()['location']
emotion = doc.to_dict()['emotions']
print(doc.id)
print(location)
print(emotion)
# In[7]:
import firebase_admin
doc_ref = db.collection('location')
#doc_ref.to_dict()
users_ref = db.collection('locations')
docs = users_ref.stream()
for doc in docs:
print(u'{} => {}'.format(doc.id, doc.to_dict()))
# In[ ]:
# In[ ]: