http_code = curl_cmd.getinfo(pycurl.HTTP_CODE)
#print 'HTTP_CODE: {}'.format(http_code)
curl_cmd.close()
- if http_code == 204:
- return None
- elif http_code == 404:
- if data.getvalue():
- return json.loads(data.getvalue().decode())
- else:
- return "NOT FOUND"
+ # TODO 202 accepted should be returned somehow
if data.getvalue():
- return json.loads(data.getvalue().decode())
- return "Failed"
+ return http_code, json.loads(data.getvalue().decode())
+ else:
+ return http_code, None
def send_cmd(self, endpoint='', postfields_dict=None,
formfile=None, filename=None,