Quickies

[categories] [index] [all (527)] [latest]

Python
  1. #!/usr/bin/python
    
    import socket
    from urllib import urlopen
    
    socket.setdefaulttimeout(2) # secondes
    
    try:
        print urlopen("http://checkip.dyndns.org").readlines()
    except IOError:
        print "timeout"