using wakatime package v0.4.3

This commit is contained in:
Alan Hamlett 2013-09-04 23:27:58 -07:00
parent e038db78ce
commit ea8cbdcb67
3 changed files with 15 additions and 6 deletions

View File

@ -3,6 +3,12 @@ History
------- -------
0.4.3 (2013-09-04)
++++++++++++++++++
- Encoding json as utf-8 before making request
0.4.2 (2013-09-04) 0.4.2 (2013-09-04)
++++++++++++++++++ ++++++++++++++++++

View File

@ -1,8 +1,8 @@
Wakati.Me WakaTime
========= ========
Wakati.Me is a time tracking api for text editors. This is the command line Automatic time tracking for your text editor. This is the command line
action event appender for the Wakati.Me api. You shouldn't need to directly event appender for the WakaTime api. You shouldn't need to directly
use this outside of a text editor plugin. use this outside of a text editor plugin.

View File

@ -12,7 +12,7 @@
from __future__ import print_function from __future__ import print_function
__title__ = 'wakatime' __title__ = 'wakatime'
__version__ = '0.4.2' __version__ = '0.4.3'
__author__ = 'Alan Hamlett' __author__ = 'Alan Hamlett'
__license__ = 'BSD' __license__ = 'BSD'
__copyright__ = 'Copyright 2013 Alan Hamlett' __copyright__ = 'Copyright 2013 Alan Hamlett'
@ -146,9 +146,12 @@ def send_action(project=None, branch=None, key=None, targetFile=None,
'Authorization': auth, 'Authorization': auth,
} }
# json request content
content = json.dumps(data).encode('utf-8')
# send action to api # send action to api
try: try:
response = requests.post(url, data=str(json.dumps(data)), headers=headers) response = requests.post(url, data=content, headers=headers)
except requests.exceptions.RequestException as exc: except requests.exceptions.RequestException as exc:
exception_data = { exception_data = {
sys.exc_info()[0].__name__: str(sys.exc_info()[1]), sys.exc_info()[0].__name__: str(sys.exc_info()[1]),