refactor(utils): replace requests with urllib and improve error handling

Replace external `requests` calls with `urllib` to eliminate third‑party dependency, add robust timeout handling, and improve error reporting. This also standardises URL fetching across the module and updates the process name configuration.

Enhancements:
- Added default request timeout fallback and ensured proper cleanup of response objects
- Enriched exception messages for better debugging

Bug Fixes:
- Fixed potential timeout‑related crashes in `CurrencyCache` and `Conversion`
- Corrected process name setting via `set_process_name` in the entry point
This commit is contained in:
sankalp committed 2026-04-09 19:20:55 +05:45
1 parent 40ddabe7fc
commit 345ef643e1
2 files changed
+25 -13

No files matched your search

+7 -2
View File
@@ -6,10 +6,15 @@ import os
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
# Add the project root to sys.path to allow absolute imports from 'utils'
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from signal import SIGINT, SIGTERM, signal
from threading import Event, Timer
import setproctitle
from utils.functions import set_process_name
from pywayland.client.display import Display
from pywayland.protocol.idle_inhibit_unstable_v1.zwp_idle_inhibit_manager_v1 import (
ZwpIdleInhibitManagerV1,
@@ -182,5 +187,5 @@ def main() -> None:
if __name__ == "__main__":
setproctitle.setproctitle("modus-inhibit")
set_process_name("modus-inhibit")
main()