refactor: improved error handling, timeouts and use temp files
This commit is contained in:
@@ -90,11 +90,19 @@ def load_missing_modules():
|
||||
os.makedirs(custom_modules_path, exist_ok=True)
|
||||
|
||||
try:
|
||||
f = requests.get(
|
||||
"https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt"
|
||||
).text
|
||||
except Exception:
|
||||
logging.error("Failed to fetch custom modules list")
|
||||
resp = requests.get(
|
||||
"https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt",
|
||||
timeout=10,
|
||||
)
|
||||
if not resp.ok:
|
||||
logging.error(
|
||||
"Failed to fetch custom modules list: HTTP %s",
|
||||
resp.status_code,
|
||||
)
|
||||
return
|
||||
f = resp.text
|
||||
except Exception as e:
|
||||
logging.error("Failed to fetch custom modules list: %s", e)
|
||||
return
|
||||
modules_dict = {
|
||||
line.split("/")[-1].split()[0]: line.strip() for line in f.splitlines()
|
||||
|
||||
Reference in New Issue
Block a user