Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2, json
- # This function returns a dictionary with the minecraft server status.
- def getstatus():
- f = urllib2.urlopen('http://mc.nexua.org/status.json')
- result = f.read()
- data = json.loads(result)
- return data
- # Are we running this as a standalone command line script? lets print some example output.
- if __name__ == '__main__':
- status = getstatus()
- print status # Print the whole thing
- print 'Online?', status['online'] # Are we online?
- print 'Last Checked', status['checked'] # Last time we checked it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement