|
9 | 9 |
|
10 | 10 | TOKEN = "adxg1kq5a4g04k0wk0s4wkssow8osw84" |
11 | 11 |
|
12 | | -key = 'temp.ljx' |
13 | | -rows = [] |
14 | | - |
15 | | -for i, day in enumerate([date.today()-timedelta(days=d) for d in range(0, 14)]): |
16 | | - n = 20 + randint(0, 15) |
17 | | - rows.append({'key': key, 'value': n, 'date': day.strftime("%Y-%m-%d")}) |
18 | | - |
19 | | -if insert_all(rows, token=TOKEN): |
20 | | - print "Inserted", len(rows), "rows." |
21 | | - |
22 | | - |
23 | 12 | from databox import Client |
24 | 13 |
|
25 | | -client = Client('<access token>') |
26 | | -client.push('sales.total', 1447.0) |
27 | | -client.push('orders.total', 32, date='2015-01-01 09:00:00') |
| 14 | +client = Client(TOKEN) |
| 15 | +# client.push('sales.total', 1447.0) |
| 16 | +#client.push('orders.total', 32, date='2015-01-01 09:00:00') |
| 17 | + |
| 18 | +# key = 'temp.ljx' |
| 19 | +# rows = [] |
| 20 | +# |
| 21 | +# for i, day in enumerate([date.today()-timedelta(days=d) for d in range(0, 14)]): |
| 22 | +# n = 20 + randint(0, 15) |
| 23 | +# rows.append({'key': key, 'value': n, 'date': day.strftime("%Y-%m-%d")}) |
| 24 | +# |
| 25 | +# if insert_all(rows, token=TOKEN): |
| 26 | +# print "Inserted", len(rows), "rows." |
| 27 | +# |
| 28 | +# |
28 | 29 |
|
29 | | -print client.last_push() |
30 | 30 |
|
31 | | -client.insert_all([ |
| 31 | +print client.insert_all([ |
32 | 32 | {'key': 'temp.boston', 'value': 51}, |
33 | 33 | {'key': 'temp.boston', 'value': 49, 'date': '2015-01-01 17:00:00'}, |
34 | | - {'key': 'sales.total', 'value': 3000}, |
| 34 | + {'key': 'sales.total', 'value': 3000, 'attributes': { |
| 35 | + 'name': "Oto", |
| 36 | + 'price': 199 |
| 37 | + }}, |
35 | 38 | ]) |
36 | 39 |
|
| 40 | +print client.last_push() |
37 | 41 |
|
38 | | - |
39 | | -from databox import push, insert_all, last_push |
40 | | -push('sales.total', 1448.9, token=TOKEN) |
41 | | -print last_push(TOKEN) |
0 commit comments