Fix hipchat.send_message when using API v2

hipchat.send_message fails with
{u'error': {u'message': u'Invalid content type: None', u'code': 400, u'type': u'Bad Request'}}
when using v2
This commit is contained in:
Marco Orovecchia 2015-07-20 16:03:20 +02:00
parent 390aa7d28f
commit 3a9f5b037f

View file

@ -134,6 +134,9 @@ def _query(function, api_key=None, api_version=None, method='GET', data=None):
elif api_version == 'v2':
headers['Authorization'] = 'Bearer {0}'.format(api_key)
data = json.dumps(data)
if method == 'POST':
headers['Content-Type'] = 'application/json'
else:
log.error('Unsupported HipChat API version')
return False