Closed ryansurf closed 4 months ago
When calling curl localhost:8000?json for json output, the forecast is hard to read.
curl localhost:8000?json
This is how it looks:
curl localhost:8000?json { "Location : ": "San Diego", "Height: ": 3.8, "Direction: ": 254.0, "Period: ": 9.1, "UV Index: ": 7.6, "Forecast: ": "\"{'forecasts': [{'date': '2024-05-27', 'surf height': 4.0, 'swell direction': 253.2, 'swell period': 9.4}, {'date': '2024-05-28', 'surf height': 4.3, 'swell direction': 254.5, 'swell period': 9.8}, {'date': '2024-05-29', 'surf height': 5.4, 'swell direction': 272.8, 'swell period': 10.0}, {'date': '2024-05-30', 'surf height': 5.7, 'swell direction': 279.4, 'swell period': 10.4}, {'date': '2024-05-31', 'surf height': 5.4, 'swell direction': 262.8, 'swell period': 12.0}, {'date': '2024-06-01', 'surf height': 5.1, 'swell direction': 225.3, 'swell period': 12.8}, {'date': '2024-06-02', 'surf height': 6.1, 'swell direction': 233.5, 'swell period': 12.6}]}\"" }
It should look something like:
curl localhost:8000?json { "Location : ": "San Diego", "Height: ": 3.8, "Direction: ": 254.0, "Period: ": 9.1, "UV Index: ": 7.6, { "Forecasts": [ { "date": "2024-05-27", "surf height": 4.0, "swell direction": 253.2, "swell period": 9.4 }, { "date": "2024-05-28", "surf height": 4.3, "swell direction": 254.5, "swell period": 9.8 }, { "date": "2024-05-29", "surf height": 5.4, "swell direction": 272.8, "swell period": 10.0 }, { "date": "2024-05-30", "surf height": 5.7, "swell direction": 279.4, "swell period": 10.4 }, { "date": "2024-05-31", "surf height": 5.4, "swell direction": 262.8, "swell period": 12.0 }, { "date": "2024-06-01", "surf height": 5.1, "swell direction": 225.3, "swell period": 12.8 }, { "date": "2024-06-02", "surf height": 6.1, "swell direction": 233.5, "swell period": 12.6 } ] }
Code should be in helper.py, forecast_to_json() and maybe json_output
helper.py
forecast_to_json()
json_output
ae65649
When calling
curl localhost:8000?json
for json output, the forecast is hard to read.This is how it looks:
It should look something like:
Code should be in
helper.py
,forecast_to_json()
and maybejson_output