From 517a0e1f7cfdc90bd86640b368310f7c01bdb4c5 Mon Sep 17 00:00:00 2001 From: A_D Date: Fri, 16 Oct 2020 08:06:39 +0200 Subject: [PATCH] Added timeout to GET for killswitches --- killswitch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/killswitch.py b/killswitch.py index 13c1b124..bb674c53 100644 --- a/killswitch.py +++ b/killswitch.py @@ -1,5 +1,4 @@ """Fetch kill switches from EDMC Repo.""" -from ast import parse from typing import Dict, List, NamedTuple, Optional, Union, cast import requests @@ -73,7 +72,7 @@ def fetch_kill_switches(target=DEFAULT_KILLSWITCH_URL) -> Optional[KILL_SWITCH_J """ logger.info("Attempting to fetch kill switches") try: - data = requests.get(target).json() + data = requests.get(target, timeout=10).json() except ValueError as e: logger.warning(f"Failed to get kill switches, data was invalid: {e}")