mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2026-06-13 04:04:59 +03:00
Merge pull request #863 from kronarq/requests-to-urllib-fixes
Fix urllib/requests mismatch in fetch_and_parse_csv fallback
This commit is contained in:
+7
-5
@@ -2972,11 +2972,13 @@ def fetch_and_parse_csv():
|
||||
|
||||
# Fallback to online if local fails
|
||||
try:
|
||||
response = urllib.request.urlopen(CSV_URL, timeout=5)
|
||||
response.raise_for_status()
|
||||
csv_data = [row for row in csv.DictReader(response.text.splitlines())]
|
||||
print("Fetched UMU database from online as fallback.")
|
||||
except requests.exceptions.RequestException as e:
|
||||
with urllib.request.urlopen(CSV_URL, timeout=5) as response:
|
||||
if response.status != 200:
|
||||
raise Exception(f"HTTP {response.status}")
|
||||
content = response.read().decode('utf-8')
|
||||
csv_data = [row for row in csv.DictReader(content.splitlines())]
|
||||
print("Fetched UMU database from online as fallback.")
|
||||
except (urllib.error.URLError, Exception) as e:
|
||||
print(f"Failed to fetch UMU data from the internet: {e}")
|
||||
csv_data = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user