Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _on_fbns_connack(self, flags, returncode, data):
if returncode != 0:
desc = FBNSConnAckReturnCodes.get(returncode, 'Unknown')
raise Exception('Connack returncode: {returncode} - {desc}'.format(**locals()))
data = data.decode('utf8')
logger.debug('[FBNS CONNACK] {data}'.format(**locals()))
data = json.loads(data)
self.on_fbns_auth(data)
self._register()
def _on_fbns_message(self, payload):
# It's instagram event
logger.debug('[FBNS_MSG] {payload}'.format(**locals()))
self.on_fbns_message(payload)
def _on_fbns_register(self, payload):
# Sucsessuf registered in FBNS and we got notification token for Instagram API registration
if payload.get('error', None):
error = payload['error']
raise Exception('FBNS Register error message: {error}'.format(**logger))
token = payload.get('token')
logger.debug('[REG_RESP_TOPIC] {token}'.format(**locals()))
self.on_fbns_token(token)
def _keep_connection(self):
super()._keep_connection()
logger.debug('[KEEP ALIVE]')