I have following function that gives me errors. It should extract the IP from the website url Sometimes it works sometimes i get following error:
File "test.py", line 30, in getIPextA
address = grab[0] # get address as a string
IndexError: list index out of range
Function:
def getIPextA():
"""
Version A Get external ip from "http://checkip.dyndns.org/"
"""
site=geturldata("http://checkip.dyndns.org/")
if site =="" : return [0,0,0,0]
grab = re.findall('\d{2,3}.\d{2,3}.\d{2,3}.\d{2,3}',site)
address = grab[0] # get address as a string
return map(int,address.split('.')) # as an integer list
geturldata?