Getting external IP address

Sion Arrowsmith siona at chiark.greenend.org.uk
Tue Mar 6 12:11:59 EST 2007


Steven D'Aprano  <steve at REMOVEME.cybersource.com.au> wrote:
>I have a PC behind a firewall, and I'm trying to programmatically
>determine the IP address visible from outside the firewall.
>  [ ... ]
>Can anyone help me fix that code snippet, or suggest another (better) way
>to get the externally visible IP address?

Depending on your circumstances, it may be possible to just ask the
firewall. You'll probably need some kind of administrator login, and
may well have to parse HTML if it's only got a web interface, but it
does mean that you don't have to connect to anything in the outside
world.

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list