JSON feed for Source servers

I’m kind of a statistics whore.

To further my pursuit of more statistics, I’ve developed a Python CGI which provides a JSON feed of all sorts of information about servers based on Valve’s Source engine.

This script has three dependencies outside of what is in the standard Python library:

Once you have those installed (worst-case scenario just drop them in the same directory as sourcejson.py), you need to edit sourcejson.ini.  This file just has three options: rcon_pass, ip, and port.  If you don’t have the rcon password for the server you wish to monitor just leave it blank.

To access the JSON feed just use the url to sourcejson.py.  Something like this:

http://YOUR_DOMAIN/sourcejson.py

To access the extended information that having an rcon password allows use:

http://YOUR_DOMAIN/sourcejson.py?info=extended

If you use the extended format, but haven’t provided an rcon password in sourcejson.ini, it will just default to the basic feed.

Included in the zip is a .htaccess to prevent directory listings, which will help protect the contents of sourcejson.ini.

Download sourcejson here!

Leave a Reply