Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def call(self, method, payload: Dict=None):
try:
async with async_timeout.timeout(5):
rpc_con = await aiomas.rpc.open_connection(self.socketfile)
call = getattr(rpc_con.remote, method)
resp = payload is not None and await call(payload) or await call()
await rpc_con.close()
return resp
except asyncio.TimeoutError:
return