The best way of finding the IP address using python, that I have seen so far. Look for "Jean Paul Calderone's" post in the below link.
Clean way to get one's network IP address? - comp.lang.python | Google Groups
Here is what he posted.
>>> from socket import socket, SOCK_DGRAM, AF_INET
>>> s = socket(AF_INET, SOCK_DGRAM)
>>> s.connect(('google.com', 0))
>>> s.getsockname()
('192.168.1.113', 43711)
1 comment:
Thanks for the information, but when I try at my webhosting, those script won't work. Is it because the webhosting disabled the socket connection?
Post a Comment