Browse Source

await

master
gsd 2 years ago
parent
commit
f6135820b0
  1. 8
      ext/python-a2s-rcon-api/service.py

8
ext/python-a2s-rcon-api/service.py

@ -1,8 +1,8 @@
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.responses import JSONResponse, Response from fastapi.responses import JSONResponse, Response
import os, argparse import os, argparse
from a2s import ainfo as VALVE_SERVER_INFO from a2s import info as VALVE_SERVER_INFO
from a2s import aplayers as VALVE_SERVER_PLAYERS from a2s import players as VALVE_SERVER_PLAYERS
#from rcon.source import rcon as VALVE_SERVER_RCON #from rcon.source import rcon as VALVE_SERVER_RCON
from custom_rcon import rcon as VALVE_SERVER_RCON from custom_rcon import rcon as VALVE_SERVER_RCON
from time import time from time import time
@ -77,7 +77,7 @@ class SourceBackend:
if not request.address: if not request.address:
return Response(status_code=409) return Response(status_code=409)
try: try:
return JSONResponse(content=dict(await VALVE_SERVER_INFO(request.tuple_address))) return JSONResponse(content=dict(VALVE_SERVER_INFO(request.tuple_address)))
except: except:
print(request.__dict__) print(request.__dict__)
traceback.print_exc() traceback.print_exc()
@ -89,7 +89,7 @@ class SourceBackend:
if not request.address: if not request.address:
return Response(status_code=409) return Response(status_code=409)
try: try:
return JSONResponse(content=dict(await VALVE_SERVER_PLAYERS(request.tuple_address))) return JSONResponse(content=dict(VALVE_SERVER_PLAYERS(request.tuple_address)))
except: except:
print(request.__dict__) print(request.__dict__)
traceback.print_exc() traceback.print_exc()

Loading…
Cancel
Save