dynamic config reloading
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# services/torn_api.py
|
||||
import aiohttp
|
||||
import asyncio
|
||||
from config import TORN_API_KEY
|
||||
import config
|
||||
from .ffscouter import fetch_batch_stats
|
||||
from .server_state import STATE
|
||||
|
||||
@@ -21,7 +21,7 @@ async def populate_faction(faction_id: int, kind: str):
|
||||
#Fetch members + FFScouter estimates once and store in STATE.
|
||||
#kind: "friendly" or "enemy"
|
||||
|
||||
url = f"https://api.torn.com/v2/faction/{faction_id}?selections=members&key={TORN_API_KEY}"
|
||||
url = f"https://api.torn.com/v2/faction/{faction_id}?selections=members&key={config.TORN_API_KEY}"
|
||||
|
||||
try:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
@@ -86,7 +86,7 @@ async def refresh_status_loop(faction_id: int, kind: str, lock: asyncio.Lock, in
|
||||
#Periodically refresh member statuses in STATE.
|
||||
while True:
|
||||
try:
|
||||
url = f"https://api.torn.com/v2/faction/{faction_id}?selections=members&key={TORN_API_KEY}"
|
||||
url = f"https://api.torn.com/v2/faction/{faction_id}?selections=members&key={config.TORN_API_KEY}"
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
|
||||
Reference in New Issue
Block a user