Skip to content

Commit f566443

Browse files
committed
added documentation to batch uploads
fixed typo in old docs changed version numbers
1 parent 81fcf0a commit f566443

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,23 @@ Once you have your Project ID, use the client like so:
3636
client.add_event("sign_ups", {
3737
"username": "lloyd",
3838
"referred_by": "harry"
39-
}
39+
})
40+
41+
##### Send Batch Events to Keen IO
42+
43+
You can upload Events in a batch, like so:
44+
45+
client.add_events({
46+
"sign_ups": [
47+
{ "username": "nameuser1" },
48+
{ "username": "nameuser2" }
49+
],
50+
"purchases": [
51+
{ "price": 5 },
52+
{ "price": 6 }
53+
]
54+
})
55+
4056

4157
##### Do analysis with Keen IO
4258

@@ -46,6 +62,10 @@ That's it! After running your code, check your Keen IO Project to see the event
4662

4763
### Changelog
4864

65+
##### 0.1.8
66+
67+
+ Added support for publishing events in batches
68+
4969
##### 0.1.7
5070

5171
+ Bugfix to use write key when sending events - do not use 0.1.6!

keen/tests/base_test_case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ def to_mixed(cls, underscore_input):
6464
for i in range(1, word_count):
6565
word_list[i] = string.capwords(word_list[i])
6666
ret = ''.join(word_list)
67-
return ret
67+
return ret

keen/tests/client_tests.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,17 @@ def test_direct_persistence_strategy(self):
5454
api_key = "2e79c6ec1d0145be8891bf668599c79a"
5555
write_key = scoped_keys.encrypt(api_key, {"allowed_operations": ["write"]})
5656
client = KeenClient(project_id, write_key=write_key)
57-
client.add_event("python_test", {"hello": "goodbye"})
57+
client.add_event("python_test", {"hello": "goodbye"})
58+
client.add_events(
59+
{"sign_ups": [
60+
{
61+
"username": "timmy",
62+
"referred_by": "steve",
63+
"son_of": "my_mom"
64+
},
65+
],
66+
"purchases": [
67+
{ "price": 5 },
68+
{ "price": 6 },
69+
{ "price": 7 }
70+
]})

0 commit comments

Comments
 (0)