The Python programming language is often used in data science applications. This short example illustrates how to query a Buzzy Datatable from Python.
import requests
import json
credentials = {
"email":"my-email@buzzy.buzz",
"password":"my-password"
}
loginResponse = requests.post("https://a.buzzy.buzz/api/login",data=credentials)
print('Log into Buzzy Server Status',loginResponse.status_code)
if (loginResponse.status_code == 200):
print('Log into Buzzy Server Response\n',loginResponse.text)
rtext = json.loads(loginResponse.text)
rdata = rtext["data"]
authToken = rdata["authToken"]
userId = rdata["userId"]
print('authToken:', authToken)
print('userId:', userId)
headers = {'X-Auth-Token': authToken, 'X-User-Id' : userId }
mID = {"microAppID" : "insert microapp id here"}
appResponse = requests.post("https://a.buzzy.buzz/api/microappdata",headers=headers,data=mID)
rtext = json.loads(appResponse.text)
body = rtext["body"]
microAppRows = body["microAppRows"]
for row in microAppRows:
print(row)
print("Done.")