Advertisement
Azelphur

Untitled

Oct 24th, 2011
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import urllib2, json
  2.  
  3. # This function returns a dictionary with the minecraft server status.
  4. def getstatus():
  5.     f = urllib2.urlopen('http://mc.nexua.org/status.json')
  6.     result = f.read()
  7.     data = json.loads(result)
  8.     return data
  9.  
  10. # Are we running this as a standalone command line script? lets print some example output.
  11. if __name__ == '__main__':
  12.     status = getstatus()
  13.     print status # Print the whole thing
  14.     print 'Online?', status['online'] # Are we online?
  15.     print 'Last Checked', status['checked'] # Last time we checked it
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement