From f0942f0714e2e8b72c72237ab9d93d2f5214b224 Mon Sep 17 00:00:00 2001 From: Katos <7927609+katosdev@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:00:25 +0100 Subject: [PATCH] Add error handling to API pulls --- .github/scripts/update_currencies.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/scripts/update_currencies.py b/.github/scripts/update_currencies.py index c7be4de9..95ad2d9a 100644 --- a/.github/scripts/update_currencies.py +++ b/.github/scripts/update_currencies.py @@ -5,6 +5,10 @@ import os def fetch_currencies(): response = requests.get('https://restcountries.com/v3.1/all') response.raise_for_status() + except requests.RequestException as e: + print(f"An error occurred: {e}") + return [] + countries = response.json() currencies_list = []