Compare commits

...

1 Commits

Author SHA1 Message Date
pixeebot[bot]
0a636e4a76
Add timeout to requests calls 2024-05-30 21:28:43 +00:00
2 changed files with 231 additions and 231 deletions

View File

@ -39,7 +39,7 @@ def watch_iocs():
iocs_list = [] iocs_list = []
to_delete = [] to_delete = []
try: try:
res = requests.get(w["url"], verify=False) res = requests.get(w["url"], verify=False, timeout=60)
if res.status_code == 200: if res.status_code == 200:
content = json.loads(res.content) content = json.loads(res.content)
iocs_list = content["iocs"] if "iocs" in content else [] iocs_list = content["iocs"] if "iocs" in content else []
@ -88,7 +88,7 @@ def watch_whitelists():
elements = [] elements = []
to_delete = [] to_delete = []
try: try:
res = requests.get(w["url"], verify=False) res = requests.get(w["url"], verify=False, timeout=60)
if res.status_code == 200: if res.status_code == 200:
content = json.loads(res.content) content = json.loads(res.content)
elements = content["elements"] if "elements" in content else [] elements = content["elements"] if "elements" in content else []

View File

@ -25,7 +25,7 @@ class Update(object):
""" """
if read_config(("frontend", "update")): if read_config(("frontend", "update")):
try: try:
res = requests.get(self.project_url) res = requests.get(self.project_url, timeout=60)
res = json.loads(res.content.decode("utf8")) res = json.loads(res.content.decode("utf8"))
with open(os.path.join(self.app_path, "VERSION")) as f: with open(os.path.join(self.app_path, "VERSION")) as f: