diff options
Diffstat (limited to 'QueryServer.py')
-rwxr-xr-x | QueryServer.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/QueryServer.py b/QueryServer.py index 9227e5a..230bbee 100755 --- a/QueryServer.py +++ b/QueryServer.py @@ -26,6 +26,7 @@ sourcequeryinc = [107410, 346110] # ARMA III # ARK: Survival Evolved import json import socket import struct + from SteamAPI import SteamAPI if CACHE_TTL > 0: @@ -57,13 +58,16 @@ class QueryServer: socket.setdefaulttimeout(5) if int(gameid) in sourcequery: print("Querying server...") - serverdata = QueryServer._querySourceServer(ip, port, gameid) - - if CACHE_TTL > 0: - serialized = json.dumps(serverdata) - Caching.writeCache( - "server", "%s-%s-%s" % (str(gameid), ip, str(port)), serialized - ) + try: + serverdata = QueryServer._querySourceServer(ip, port, gameid) + + if CACHE_TTL > 0: + serialized = json.dumps(serverdata) + Caching.writeCache( + "server", "%s-%s-%s" % (str(gameid), ip, str(port)), serialized + ) + except Exception: + return None return serverdata |