|
@@ -0,0 +1,28 @@
|
|
|
+#!/usr/bin/python
|
|
|
+
|
|
|
+import json
|
|
|
+import requests
|
|
|
+
|
|
|
+class DashingAdapter:
|
|
|
+ base_url = None
|
|
|
+
|
|
|
+ def __init__(self, base_url, auth_token):
|
|
|
+ self.base_url = base_url
|
|
|
+ self.auth_token = auth_token
|
|
|
+
|
|
|
+ def send(self, metric, current, previous=None, blubb=None, bla=None):
|
|
|
+ info = {
|
|
|
+ 'auth_token': self.auth_token,
|
|
|
+ 'current': int(current),
|
|
|
+ }
|
|
|
+ if not previous is None:
|
|
|
+ info['previous'] = previous
|
|
|
+
|
|
|
+ url = self.base_url + metric
|
|
|
+ r = requests.post(url, data=json.dumps(info))
|
|
|
+ return r
|
|
|
+
|
|
|
+if __name__ == "__main__":
|
|
|
+ d = DashingAdapter('http://dashing.krombel.de:3030/widgets/', 'bitnhmlj47hamrftxkiug')
|
|
|
+ d.send('testNumber', 42)
|
|
|
+
|