encode json when sending to urllib

This commit is contained in:
Alan Hamlett 2014-08-07 08:21:06 -07:00
parent 9128585fe8
commit 1e50a6a1b6
2 changed files with 2 additions and 1 deletions

1
.gitignore vendored
View File

@ -36,3 +36,4 @@ nosetests.xml
virtualenv
venv
.DS_Store

View File

@ -284,7 +284,7 @@ def send_action(project=None, branch=None, stats=None, key=None, targetFile=None
log.debug(data)
# setup api request
request = Request(url=url, data=json.dumps(data))
request = Request(url=url, data=str.encode(json.dumps(data)))
request.add_header('User-Agent', get_user_agent(plugin))
request.add_header('Content-Type', 'application/json')
auth = unicode('Basic {key}').format(key=bytes.decode(base64.b64encode(str.encode(key))))