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)
20201 . Run tests: You'll need redis running locally on its default port of 6379.
2121
2222 $ 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 1010
1111ch = logging .StreamHandler (sys .stdout )
1212ch .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' )
1414ch .setFormatter (formatter )
1515root .addHandler (ch )
1616
Original file line number Diff line number Diff line change 11from __future__ import absolute_import
22
33import errno
4- import json
54from threading import Thread
65
6+ import jsonpickle
77import requests
88from requests .packages .urllib3 .exceptions import ProtocolError
99
@@ -42,12 +42,15 @@ def do_send(should_retry):
4242 body = [events ]
4343 else :
4444 body = events
45+
46+ json_body = jsonpickle .encode (body , unpicklable = False )
47+ log .debug ('Sending events payload: ' + json_body )
4548 hdrs = _headers (self .sdk_key )
4649 uri = self ._config .events_uri
4750 r = self ._session .post (uri ,
4851 headers = hdrs ,
4952 timeout = (self ._config .connect_timeout , self ._config .read_timeout ),
50- data = json . dumps ( body ) )
53+ data = json_body )
5154 r .raise_for_status ()
5255 except ProtocolError as e :
5356 inner = e .args [1 ]
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ CacheControl>=0.10.2
22requests >= 2.10.0
33sseclient >= 0.0.12
44future >= 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