Re: Obtaining the remote ip address

Discussion in 'Python' started by Ben Finney, Mar 28, 2006.

  1. Ben Finney

    Ben Finney Guest

    "Alvin A. Delagon" <> writes:

    > I have a python cgi script running behind a CGI server which is also
    > built using python using CGIHTTPServer module. How can my cgi script
    > obtain the remote ip address?


    The CGI specification lists a number of environment variables that are
    set for the scrit receiving the request. The one you want is
    REMOTE_ADDR, and possibly REMOTE_HOST.

    <URL:http://hoohoo.ncsa.uiuc.edu/cgi/env.html>

    Python makes environment variables available via the 'os.environ' map.

    <URL:http://docs.python.org/lib/os-procinfo.html>

    --
    \ "I cannot conceive that anybody will require multiplications at |
    `\ the rate of 40,000 or even 4,000 per hour ..." -- F. H. Wales |
    _o__) (1936) |
    Ben Finney
    Ben Finney, Mar 28, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. avnrao
    Replies:
    1
    Views:
    7,210
    avnrao
    May 4, 2004
  2. Justin Ezequiel

    Obtaining the remote ip address

    Justin Ezequiel, Mar 28, 2006, in forum: Python
    Replies:
    3
    Views:
    843
    Peter Hansen
    Mar 28, 2006
  3. Replies:
    0
    Views:
    318
  4. Dido Sevilla
    Replies:
    1
    Views:
    217
    Anders Engström
    Feb 23, 2005
  5. Victor Rosillo
    Replies:
    2
    Views:
    163
    Bill Kelly
    Nov 24, 2007
Loading...

Share This Page