logging errors from api requests. swapping time and endtime if needed.

This commit is contained in:
Alan Hamlett 2013-07-07 18:22:17 -07:00
parent c2124ceb8c
commit 61315ea721

View file

@ -97,6 +97,10 @@ def parseArguments():
args.key = default_key args.key = default_key
else: else:
parser.error('Missing api key') parser.error('Missing api key')
if args.endtime and args.endtime < args.timestamp:
tmp = args.timestamp
args.timestamp = args.endtime
args.endtime = tmp
return args return args
@ -165,12 +169,16 @@ def send_action(project=None, tags=None, key=None, targetFile=None,
data['traceback'] = traceback.format_exc() data['traceback'] = traceback.format_exc()
log.error(data) log.error(data)
else: else:
if response.getcode() >= 200 and response.getcode() < 300:
log.debug({ log.debug({
'response_code': response.getcode(), 'response_code': response.getcode(),
'response_content': response.read(), 'response_content': response.read(),
}) })
if response.getcode() >= 200 and response.getcode() < 300:
return True return True
log.error({
'response_code': response.getcode(),
'response_content': response.read(),
})
return False return False