Exemple #1
0
class ServerLib(object):
    def __init__(self, address):
        self.address = address
        self.server = ServerQuerier(address)
        self.server.ping()

    def getInfo(self):
        _ = self.server.info()
        return _.values

    def getPlayers(self):
        rv = []
        _ = self.server.players()
        for player in _['players']:
            rv.append(player.values)
        return rv
Exemple #2
0
# -*- coding: utf-8 -*-
import pprint

from valve.source.a2s import ServerQuerier


server = ServerQuerier(('dyn.momoka.net', 27016))
_ = server.ping()
print(_)

_ = server.info()
pprint.pprint(_.values)

_ = server.players()
for player in _['players']:
    pprint.pprint(player.values)