Здравствуйте, написал код по документации, а он не работает. Интересно почему:
import valve.source.a2s
SERVER_ADDRESS = ("65.109.155.126", 27877)
with valve.source.a2s.ServerQuerier(SERVER_ADDRESS) as server:
info = server.info()
players = server.players()
print("{player_count}/{max_players} {server_name}".format(**info))
for player in sorted(players["players"],
key=lambda p: p["score"], reverse=True):
print("{score} {name}".format(**player))
Ошибка:
Traceback (most recent call last):
File "C:\Users\Geo\PycharmProjects\onl\main.py", line 5, in
with valve.source.a2s.ServerQuerier(SERVER_ADDRESS) as server:
TypeError: 'ServerQuerier' object does not support the context manager protocol