3

I have a Pythonic HTTP server that is supposed to determine client's IP. How do I do that in Python? Is there any way to get the request headers and extract it from there?

PS: I'm using WebPy.

2 Answers 2

4

Use web.ctx:

class example:
    def GET(self):
        print web.ctx.ip

More info here

Sign up to request clarification or add additional context in comments.

Comments

3

web.env.get('REMOTE_ADDR')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.