-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataWriteSide.py
More file actions
40 lines (30 loc) · 897 Bytes
/
DataWriteSide.py
File metadata and controls
40 lines (30 loc) · 897 Bytes
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
from firebase_admin import credentials
from firebase_admin import firestore, storage
from ResultSide import *
from FirebaseInit import *
users_ref = db.collection(u'result')
docs = users_ref.stream()
for doc in docs:
if doc.get(u'flag_side') == 1:
uid = doc.id
break
users_ref =db.collection(u'result').document(uid)
if error_index != 0:
users_ref.set({
u'flag_front':0,
u'flag_side':0,
u'error':error_index
})
else :
file = 'side_result.png'
bucket = storage.bucket()
blob = bucket.blob('side_result/'+file)
new_token = uuid4()
metadata = {"firebaseStorageDownloadTokens": new_token} #access token이 필요하다.
blob.metadata = metadata
blob.upload_from_filename(file, content_type='image/png')
users_ref.update({
u'flag_side':0,
u'error':0,
u'cheek_front':cheek_front
})