Python to tell what is the IP of my PC .

Nicolas G nicolasg at gmail.com
Wed Nov 8 19:18:34 EST 2006


On 11/9/06, Tim Williams <tim at tdw.net> wrote:
>
> On 8 Nov 2006 15:35:31 -0800, NicolasG <nicolasg at gmail.com> wrote:
> > How can I use python to get the real IP address of my DSL router (when
> > my PC is part of the local home LAN) ?
>
> The router will the PC's default gateway IP address,  if you are on a
> windows platform,  you can view it by typing IPCONFIG (enter) from a
> command prompt.


This is the  router local IP, I need to get the router "outside" IP witch is
the real one.

A quick google, gave me this,  look at the comments at the end for an
> example of finding the Default Gateway IP address using Python
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/162994


import win32api raise the error "module not exsit"
and
socket.gethostbyname(name)

the router doesn't have a hostname.

cheers ;)

-- 
Nicolas G

Skype: nicolasg_
mobile: +30 69 45 714 578
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061109/22d153b7/attachment.html>


More information about the Python-list mailing list