Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
api_ws = self._connected_clients.get(str(params['self_id']))
elif len(self._connected_clients) == 1:
api_ws = list(self._connected_clients.values())[0]
if not api_ws:
raise ApiNotAvailable
seq = _SequenceGenerator.next()
await api_ws.send(json.dumps({
'action': action,
'params': params,
'echo': {
'seq': seq
}
}))
return _handle_api_result(await ResultStore.fetch(seq))