Thread: IP adresses
View Single Post
Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Solved Threads: 16
shanenin shanenin is offline Offline
Posting Whiz in Training

Re: IP adresses

 
0
  #4
Nov 7th, 2005
This is not very efficient, but you could get your ip using a webbased service
  1. import urllib2
  2. def getip():
  3. webaddress = "http://www.getip.com"
  4. page = urllib2.urlopen(webaddress)
  5. pagetolines = page.readlines()
  6. for i in pagetolines:
  7. if i.find('<title>GetIP') != -1:
  8. ipline = i
  9. break
  10. ip = ipline.split()[-1].replace("</title>","")
  11. return ip
  12. print getip()

I am not sure how to get that on you clipboard.
In a perfect world exceptions would not be needed.
Reply With Quote