Created
October 2, 2018 22:42
-
-
Save Cightline/4bbd2ad5026811ed82b94800181f6dd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import valve.source | |
import valve.source.a2s | |
import valve.source.master_server | |
servers = [] | |
with valve.source.master_server.MasterServerQuerier() as msq: | |
print('Looking up servers...') | |
for address in msq.find(gamedir=u"arma3"): | |
try: | |
with valve.source.a2s.ServerQuerier(address) as server: | |
info = server.info() | |
players = server.players() | |
#print(info['server_name']) | |
servers.append({'name':info['server_name'], | |
'players':server.players()}) | |
except valve.source.NoResponseError: | |
print('Server {}:{} timed out!'.format(*address)) | |
continue | |
print('servers found: {}'.format(len(servers))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment