[Tutor] Getting my IP

pd pd@localhost.localdomain
Sat, 30 Jun 2001 16:31:15 +1000 (EST)


Hi,
   I dont think I made myself clear when I posted my original
message. The purpose of the script is to post the ip address
of my home pc to a webpage running on a remote host. This is what is going
on.

1. I execute the script on my home pc.
2. The script fetches a html page from the web.
3. It reads the html page into a list.
4. It searches the list for a specific point (<!--IP-->) .
5. It inserts my IP address into the list after the marker.
6. It writes the processed list to a html file.
7. It sends this modified html file via ftp to
my webpage.

Any details that I need to enter are stored inside a config file which the
script accesses It is almost done except I cannot figure out how to find
out what *my* ip address is. Up until now I have just included it as a
variable (myIP = 218.13.23.45) for testing purposes. When I use 
the following line of code, I get my loopback address, as opposed to my 
dynamic IP address.

>>> from socket import *
>>> gethostbyname(gethostname())
'127.0.0.1'


I do not know much about networking/programming/sockets so detailed
answers will be greatly appreciated. I am using python 2.0, on a linux
box.