Skip to content

Commit

Permalink
Improved checking return codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik de Bueger committed Oct 24, 2022
1 parent 04002e5 commit a02c925
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ def ExtractSecurityEvents(baseurl,auth,opts,logger,cache,eventwriter) :
#params={'top':'2','count':'true'}
params={}
r = RetrievePandaEvents(opts.accountid,opts.apikey,auth,url,params)
if r.status_code != 200:
# Output debug information
logger.warning("\n Return Code: " + str(r.status_code) + " " + r.reason)
logger.warning("Path: " + r.request.path_url)
logger.warning("Headers: ")
logger.warning(r.request.headers)
continue

result=r.json()
if result==None :
continue
Expand Down Expand Up @@ -265,6 +273,13 @@ def ExtractUnmanagedDevices(baseurl,auth,opts,logger,cache,eventwriter) :
command='api/{}/accounts/{}/unmanageddevices'.format(opts.version,opts.accountid)
url='{}{}'.format(baseurl,command)
r = RetrievePandaEvents(opts.accountid,opts.apikey,auth,url,{})
if r.status_code != 200:
# Output debug information
logger.warning("\n Return Code: " + str(r.status_code) + " " + r.reason)
logger.warning("Path: " + r.request.path_url)
logger.warning("Headers: ")
logger.warning(r.request.headers)
return
result=r.json()
if result==None :
return
Expand Down

0 comments on commit a02c925

Please sign in to comment.