logging errors from api requests. swapping time and endtime if needed.
This commit is contained in:
parent
c2124ceb8c
commit
61315ea721
1 changed files with 11 additions and 3 deletions
|
@ -97,6 +97,10 @@ def parseArguments():
|
|||
args.key = default_key
|
||||
else:
|
||||
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
|
||||
|
||||
|
||||
|
@ -165,12 +169,16 @@ def send_action(project=None, tags=None, key=None, targetFile=None,
|
|||
data['traceback'] = traceback.format_exc()
|
||||
log.error(data)
|
||||
else:
|
||||
log.debug({
|
||||
if response.getcode() >= 200 and response.getcode() < 300:
|
||||
log.debug({
|
||||
'response_code': response.getcode(),
|
||||
'response_content': response.read(),
|
||||
})
|
||||
return True
|
||||
log.error({
|
||||
'response_code': response.getcode(),
|
||||
'response_content': response.read(),
|
||||
})
|
||||
if response.getcode() >= 200 and response.getcode() < 300:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue