def recover_Pilot(self):
try:
connectFlight = httplib.HTTPSConnection(Globals.httpsAddr, Globals.httpsPort, timeout=Globals.timeOut)
headers = Globals.xapikey
headers['Authorization'] = "Bearer {}".format(Globals.myToken)
connectFlight.request('GET', '/pilot/v2/profile', "", headers)
result = connectFlight.getresponse().read()
try:
parsed_json = json.loads(result)
parsed_status = parsed_json['status']
print parsed_status
Globals.pilot_id = parsed_json['data']['id']
Globals.pilotIDValid = True
except:
Globals.strPrint (self.thisGlobals,"Pilot Recover ID not found...Retry!")
Globals.strPrint (self.thisGlobals,result)
return False
if parsed_status != "success":
return False
except:
print "Create Flight Error..."
traceback.print_exc()
return Globals.pilot_id
评论列表
文章目录