- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.py
More file actions
Latest commit
28 lines (20 loc) · 774 Bytes
/
Copy pathpost.py
File metadata and controls
28 lines (20 loc) · 774 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
importrequests
url="https://test-for-python-api.firebaseio.com/.json"
print(requests.post(url))
## resp = requests.post(url, json=categoriesList) ## send requests with firebase key
## print(resp.status_code)
## print(resp.ok)
importjson
importbios
data=bios.read('categories.json')
json_data=json.dumps(data) ## converting dict to json
categories_json=json.loads(json_data)
print(json_data)
data2=bios.read('quiz.json')
json_data2=json.dumps(data2)
quiz_json=json.loads(json_data2)
print(quiz_json)
fromfirebaseimportfirebase### pip install git+https://github.com/ozgur/python-firebase
firebase=firebase.FirebaseApplication(url, None)
result=firebase.patch('/categories/', categories_json)
result2=firebase.patch('/quiz/', quiz_json)