log incoming ip addresses in web.py

柔情痞子 提交于 2020-01-03 01:28:13

问题


I'd like to log the IP addresses of machines that access my web.py application. How can I access this data within the web.py framework? I'm happy to send the address to my own logger.


回答1:


Use web.ctx['ip'] to get the remote ip address. Here is a link which explains what's in the context.



来源:https://stackoverflow.com/questions/5347484/log-incoming-ip-addresses-in-web-py

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!