I am looking for help in creating a python script that will push data, specifically to geckoboard in the form of a line graph. Currently the code I have is shown below that has been pulled together from other sources, it would be great if someone could collaborate and help me finish this, I don't know how to insert the values I want on the line graph, if it could be finished with some example values that would be great. Thanks
import requests
import json
class Gecko(object):
def __init__(self, api_key):
self.api_key = api_key
def push(self, widget_key, data):
ret = requests.post("https://push.geckoboard.com/v1/send/%s" % widget_key, json.dumps({'api_key' : self.api_key, 'data' : data}), verify=False)
if not (ret.status_code == 200 and ret.json().get('success') == True):
raise ValueError(ret.content)
def line(self, widget_key, values, **kwargs):
data = {'item' : [], 'settings' :kwargs}
for item in values:
data['item'].append(item)
return self.push(widget_key, data)
run=Gecko(****************)
print run.push(150634-85f8db34-af52-4fa3-9963-3200a9a6fe74,some_data?)
print run.line(150634-85f8db34-af52-4fa3-9963-3200a9a6fe74,100,'text')
SOLUTION:
File called test.py
File called test1.py