summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2022-10-08 20:43:13 +0200
committerAndré Glüpker <git@wgmd.de>2022-10-08 20:43:13 +0200
commit6a6a1fcca5058eedcd26c280bb003ca189e67815 (patch)
treeca20b23f8217f0ca76f848966fa6a6cee95ee7b7
parent75d015d3389c7a7f105c77a68291f293b5cdd4a0 (diff)
downloadsteam-6a6a1fcca5058eedcd26c280bb003ca189e67815.tar.gz
steam-6a6a1fcca5058eedcd26c280bb003ca189e67815.tar.bz2
steam-6a6a1fcca5058eedcd26c280bb003ca189e67815.zip
Catch exception for QueryServer
-rwxr-xr-xQueryServer.py18
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