Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def get_new_moon_dates(year:int)-> str: #it's import to specify the return type
|
|
| 29 |
|
| 30 |
if data.get('error'):
|
| 31 |
print(f"Error from USNO API: {data['error']}")
|
| 32 |
-
return
|
| 33 |
|
| 34 |
new_moon_dates = []
|
| 35 |
for phase_data in data.get('data', []):
|
|
@@ -40,7 +40,7 @@ def get_new_moon_dates(year:int)-> str: #it's import to specify the return type
|
|
| 40 |
new_moon_dates.append(date_obj)
|
| 41 |
except ValueError as e:
|
| 42 |
print(f"Error parsing date: {date_str} - {e}")
|
| 43 |
-
return
|
| 44 |
|
| 45 |
new_moon_dates.sort()
|
| 46 |
|
|
@@ -50,13 +50,13 @@ def get_new_moon_dates(year:int)-> str: #it's import to specify the return type
|
|
| 50 |
|
| 51 |
except requests.exceptions.RequestException as e:
|
| 52 |
print(f"Error during API request: {e}")
|
| 53 |
-
return
|
| 54 |
except json.JSONDecodeError as e:
|
| 55 |
print(f"Error decoding JSON response: {e}")
|
| 56 |
-
return
|
| 57 |
except Exception as e:
|
| 58 |
print(f"An unexpected error occurred: {e}")
|
| 59 |
-
return
|
| 60 |
|
| 61 |
#return "What magic will you build ?"
|
| 62 |
|
|
|
|
| 29 |
|
| 30 |
if data.get('error'):
|
| 31 |
print(f"Error from USNO API: {data['error']}")
|
| 32 |
+
return "This is a data error"
|
| 33 |
|
| 34 |
new_moon_dates = []
|
| 35 |
for phase_data in data.get('data', []):
|
|
|
|
| 40 |
new_moon_dates.append(date_obj)
|
| 41 |
except ValueError as e:
|
| 42 |
print(f"Error parsing date: {date_str} - {e}")
|
| 43 |
+
return "This is a error parsing date"
|
| 44 |
|
| 45 |
new_moon_dates.sort()
|
| 46 |
|
|
|
|
| 50 |
|
| 51 |
except requests.exceptions.RequestException as e:
|
| 52 |
print(f"Error during API request: {e}")
|
| 53 |
+
return "Error during API request"
|
| 54 |
except json.JSONDecodeError as e:
|
| 55 |
print(f"Error decoding JSON response: {e}")
|
| 56 |
+
return "Error decoding JSON response"
|
| 57 |
except Exception as e:
|
| 58 |
print(f"An unexpected error occurred: {e}")
|
| 59 |
+
return "Unexpected error"
|
| 60 |
|
| 61 |
#return "What magic will you build ?"
|
| 62 |
|