File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -20,3 +20,10 @@ Development information (for developing this module itself)
20
20
1 . Run tests: You'll need redis running locally on its default port of 6379.
21
21
22
22
$ py.test testing
23
+
24
+ Developing with different python versions
25
+ -----------------------------------------
26
+
27
+ Example for switching to python 3:
28
+
29
+ ``` virtualenv -p `which python3` ~/.virtualenvs/python-client ```
Original file line number Diff line number Diff line change 10
10
11
11
ch = logging .StreamHandler (sys .stdout )
12
12
ch .setLevel (logging .DEBUG )
13
- formatter = logging .Formatter ('%(asctime)s - %(name)s - %(levelname)s - %(message)s' )
13
+ formatter = logging .Formatter ('%(asctime)s - %(name)s:%(lineno)d - %(levelname)s - %(message)s' )
14
14
ch .setFormatter (formatter )
15
15
root .addHandler (ch )
16
16
Original file line number Diff line number Diff line change 1
1
from __future__ import absolute_import
2
2
3
3
import errno
4
- import json
5
4
from threading import Thread
6
5
6
+ import jsonpickle
7
7
import requests
8
8
from requests .packages .urllib3 .exceptions import ProtocolError
9
9
@@ -42,12 +42,15 @@ def do_send(should_retry):
42
42
body = [events ]
43
43
else :
44
44
body = events
45
+
46
+ json_body = jsonpickle .encode (body , unpicklable = False )
47
+ log .debug ('Sending events payload: ' + json_body )
45
48
hdrs = _headers (self .sdk_key )
46
49
uri = self ._config .events_uri
47
50
r = self ._session .post (uri ,
48
51
headers = hdrs ,
49
52
timeout = (self ._config .connect_timeout , self ._config .read_timeout ),
50
- data = json . dumps ( body ) )
53
+ data = json_body )
51
54
r .raise_for_status ()
52
55
except ProtocolError as e :
53
56
inner = e .args [1 ]
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ CacheControl>=0.10.2
2
2
requests >= 2.10.0
3
3
sseclient >= 0.0.12
4
4
future >= 0.15.2
5
- strict-rfc3339 >= 0.7
5
+ strict-rfc3339 >= 0.7
6
+ jsonpickle == 0.9.3
You can’t perform that action at this time.
0 commit comments