Share Pastebin
Guest
Public paste!

IceDragon

By: a guest | Apr 14th, 2009 | Syntax: Python | Size: 0.83 KB | Hits: 35 | Expires: Never
Copy text to clipboard
  1. #!/usr/bin/python                                                            
  2.  
  3. ###--# Imports #--###
  4. import urllib        
  5.  
  6. from time import time
  7.  
  8.  
  9. ###--# Configuration #--###
  10. names = [                  
  11.     "artex",              
  12.     "cpu",                
  13.     "dreamgrabber"        
  14. ]                          
  15.  
  16.  
  17. # Forming URL
  18. url = "http://on.furcadia.com/q/?%d&%s" % ( int(time()), "&".join(names) )
  19.  
  20. # Sending request and retrieving data
  21. data = urllib.urlopen(url).read()
  22.  
  23. # Parsing data
  24. for line in data.split("\n"):
  25.     if line == "":
  26.         continue
  27.  
  28.     if line[0] == "+":
  29.         print "%s is online" % line[1:]
  30.     elif line[0] == "O":
  31.         print "%4s furres online\n" % line[1:]
  32.     elif line[0] == "T":
  33.         print "T parameter: " + line[1:]
  34.     else:
  35.         print "UNIDENTIFIED: " + line