-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.py
28 lines (20 loc) · 774 Bytes
/
post.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
import requests
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)
import json
import bios
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)
from firebase import firebase ### 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)