Getting the IP-number of the caller when using the WsgiChannel

9 views
Skip to first unread message

jpersson

unread,
Nov 14, 2013, 6:40:35 AM11/14/13
to amf...@googlegroups.com
Hi,

I am still using AmFast for one of my applications and now I would like to see the IP-number of the caller (which is available in the WSGI environment, but probably never saved by AmFast). Been playing around with the code for a few hours, but I cannot really see what the best way to accomplish this would be so hints are appreciated.

There is a special WsgiChannelSet class in wsgi_channel.py. This class has a __call__ method that seems to be saving the WSGI environment in the channel in some way, but this method is never called and the channel object does not have a __call__ method, so it is all very confusing. If the method would ever be called it would simply not work.

Does anyone now how to do this? My use case is that I want to display the IP-number that the user had when he logged in the last time.

Best Regards
    //Jan Persson

Dave Thompson

unread,
Nov 14, 2013, 9:48:06 PM11/14/13
to amf...@googlegroups.com

I think the best way for you to store off the IP before or after processing the amf message is to extend the wsgi_channel class to do what you need.

--
You received this message because you are subscribed to the Google Groups "AmFast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to amfast+un...@googlegroups.com.
To post to this group, send email to amf...@googlegroups.com.
Visit this group at http://groups.google.com/group/amfast.
For more options, visit https://groups.google.com/groups/opt_out.

Jan Flyborg

unread,
Nov 26, 2013, 10:32:54 AM11/26/13
to amf...@googlegroups.com
Sorry for the extreme late response. Thanks for the help.

I'll see what I can come up with. Would you accept a patch for this?

Best Regards
    //Jan Persson



2013/11/15 Dave Thompson <dtho...@gmail.com>

Dave Thompson

unread,
Nov 26, 2013, 10:22:03 PM11/26/13
to amf...@googlegroups.com
Sure, as long as it includes tests.
Reply all
Reply to author
Forward
0 new messages