Skip to content

Commit 07c968e

Browse files
committed
Adding version to lib
1 parent f73da36 commit 07c968e

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

databox/__init__.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from os import getenv
44
from json import dumps as json_dumps
55

6+
__version__ = "0.1.5"
7+
68

79
class Client(object):
810
push_token = None
@@ -51,37 +53,36 @@ def _push_json(self, data=None, path="/"):
5153
data = json_dumps(data)
5254

5355
response = requests.post(
54-
self.push_host + path,
55-
auth=HTTPBasicAuth(self.push_token, ''),
56-
headers={'Content-Type': 'application/json'},
57-
data=data
56+
self.push_host + path,
57+
auth=HTTPBasicAuth(self.push_token, ''),
58+
headers={
59+
'Content-Type': 'application/json',
60+
'User-Agent': "Databox/" + __version__ + " (Python)"
61+
},
62+
data=data
5863
)
5964

6065
return response.json()
6166

62-
6367
def push(self, key, value, date=None, attributes=None):
6468
self.last_push_content = self._push_json({
6569
'data': [self.process_kpi(
66-
key=key,
67-
value=value,
68-
date=date,
69-
attributes=attributes
70+
key=key,
71+
value=value,
72+
date=date,
73+
attributes=attributes
7074
)]
7175
})
7276

7377
return self.last_push_content['status'] == 'ok'
7478

75-
76-
7779
def insert_all(self, rows):
7880
self.last_push_content = self._push_json({
7981
'data': [self.process_kpi(**row) for row in rows]
8082
})
8183

8284
return self.last_push_content['status'] == 'ok'
8385

84-
8586
def last_push(self, number=1):
8687
return self._push_json(path='/lastpushes/{n}'.format(**{'n': number}))
8788

@@ -95,4 +96,4 @@ def insert_all(rows=[], token=None):
9596

9697

9798
def last_push(token=None):
98-
return Client(token).last_push()
99+
return Client(token).last_push()

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# -*- coding: utf-8 -*-
22
from setuptools import setup, find_packages
3+
from databox import __version__ as version
34

45
setup(
56
name="databox",
6-
version="0.1.4",
7+
version=version,
78
author="Databox",
89
author_email="[email protected]",
9-
description="Push metrics to Databox.",
10+
description="Python wrapper for Databox - Mobile Executive Dashboard.",
1011
url="https://github.com/databox/databox-python",
1112
license='MIT',
1213
packages=find_packages(exclude=('databox test',)),

0 commit comments

Comments
 (0)