mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 21:33:02 +01:00
Add error handling to API pulls
This commit is contained in:
4
.github/scripts/update_currencies.py
vendored
4
.github/scripts/update_currencies.py
vendored
@@ -5,6 +5,10 @@ import os
|
|||||||
def fetch_currencies():
|
def fetch_currencies():
|
||||||
response = requests.get('https://restcountries.com/v3.1/all')
|
response = requests.get('https://restcountries.com/v3.1/all')
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
except requests.RequestException as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
|
return []
|
||||||
|
|
||||||
countries = response.json()
|
countries = response.json()
|
||||||
|
|
||||||
currencies_list = []
|
currencies_list = []
|
||||||
|
|||||||
Reference in New Issue
Block a user