def start_comm(self, flightID):
try:
connectFlight = httplib.HTTPSConnection(Globals.httpsAddr, Globals.httpsPort, timeout=Globals.timeOut)
headers = Globals.xapikey
headers['Authorization'] = "Bearer {}".format(Globals.myToken)
connectFlight.request('POST', '/flight/v2/{}/start-comm'.format(flightID), '', headers)
result = connectFlight.getresponse().read()
parsed_json = json.loads(result)
print parsed_json
#parsed_status = parsed_json['data']['key']['data']
parsed_status = parsed_json['data']['key']
print "H:" + parsed_status
#thisKey = (''.join(str(hex(i)[2:].zfill(2)) for i in parsed_status)).decode('hex')
thisKey = parsed_status.decode('base64')
return thisKey
except:
print "Could Not Start Comms..."
traceback.print_exc()
评论列表
文章目录