Python Quake 3 server rcon and query class

Once again, I couldn’t find a Quake 3 server query/rcon class for Python so I made one. This one is substantially better then the PHP Quake 3 rcon class that I made a few days ago. It’s called pyquake3. The features are:
* Simple interface
* Automatic retries
* Can access server variables
* Can send rcon commands
* Can collect player names, ping and frags.
* With an rcon password, can collect player ip addresses.

The Python Quake 3 project page is here.

6 thoughts on “Python Quake 3 server rcon and query class”

  1. this will fail to work if a player has negative frags
    I think the simplest way to fix it would be to change line 38 to read:

    player_reo = re.compile(r’^(-\d+|\d+) (\d+) “(.*)”‘)

    otherwise the test on line 105 will fail

    my knowledge of regular expressions is limited there may be a more elegant way.

    I just realized that will record incorrect data is it will convert a players negative frag count to positive. Maybe you would know of a good way to fix this.

  2. very nice class!!!!!!
    i am not familiar with regular expression, i wanted to extend the class to get the time(played time) for each player. i gave many try but i didn’t succeed……
    any idea?

    thx

  3. I changed the regex as follows:

    player_reo = re.compile(r’^(-?)(\d+) (\d+) “(.*)”‘)

    This introduces a new group that can then be used to check if a minus sign was present or not. So I changed the actual application of the regex to this:

    match = self.player_reo.match(player)
    if not match:
    print ‘couldnt match’, player
    continue
    negative, frags, ping, name = match.groups()
    if negative == “-“:
    frags = “-” + frags

    Certainly not the most elegant thing to do, but at least it works. I’d be curious to see what else people come up with. The only other thing I could think of was to scrap the regex and parse it apart by hand instead, probably less code overall? Not sure… Nice module BTW, I like it. :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>