[Tutor] Getting my IP

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


Hi,
   Im writing a script that posts IP number to a page on my website. This
script is nearly complete except I cannot figure out how to actually get 
my IP address. I have tried using the socket module, but it  appears that
this justs takes a look in my /etc/hosts file. What I need is my dynamic
IP that gets assigned every time I connect to the net.



Python 2.0 (#1, Apr 11 2001, 19:18:08) 
[GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux-i386
Type "copyright", "credits" or "license" for more information.
>>> from socket import *
>>> gethostbyname(gethostname())
'127.0.0.1'
>>> gethostbyaddr(gethostname())
('localhost.localdomain', ['localhost'], ['127.0.0.1'])
>>> gethostbyname('kaneda')
'127.0.0.1'
>>> getfqdn()
'localhost.localdomain'
>>> gethostnyname('kaneda')




[pd@localhost pd]$ cat /etc/hosts
127.0.0.1		localhost.localdomain localhost
127.0.0.1		localhost.localdomain kaneda
[pd@localhost pd]$