I have a funtion to get ip address of requester.
async def remote(self,request):
print(request.remote)
return web.Response(text=str(request.remote), status=200)
I need to get the port of requester. How to do it ?
I have a funtion to get ip address of requester.
async def remote(self,request):
print(request.remote)
return web.Response(text=str(request.remote), status=200)
I need to get the port of requester. How to do it ?
The answer could be found in official doc:
peername = request.transport.get_extra_info('peername')
if peername is not None:
host, port = peername