-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdd_data.py
More file actions
39 lines (32 loc) · 1.14 KB
/
Add_data.py
File metadata and controls
39 lines (32 loc) · 1.14 KB
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
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
# Ссылка на Сервисный ключ от БД на Firebase
cred = credentials.Certificate('D:/fe/smart-library-1-firebase-adminsdk-g8x7r-2d069f053c.json')
# Подключаемся к БД
firebase_admin.initialize_app(cred)
# Подключаемся
db = firestore.client()
print('Введите название коллекции:')
collection = input()
print('Введите название документа:')
ID = input()
#Запись
doc_ref = db.collection(collection).document(ID)
print('Вводите информацию так: |Название переменной|: |Значение переменной|')
print('Вводите |break| если ввод информации закончен')
while 1!=0:
info = input()
if(info == "break"):
break
a=len(info)
for i to len:
name += i
if i+1 = ":":
i+=2
while i!= a:
value += i
break
doc_ref.set({
name: value,
})