ryansurf / cli-surf

Get surf and ocean data from the command line interface
MIT License
18 stars 29 forks source link

JSON output only uses default location #22

Closed ryansurf closed 1 month ago

ryansurf commented 4 months ago

When running curl localhost:8000?json, we get:

{
    "Location": "Santa Cruz",
    "Height": 4.1,
    "Direction": 262.0,
    "Period": 9.1,
    "UV Index": 8.9,
    "Forecast": [
        {
            "date": "2024-05-28",
            "surf height": 4.1,
            "swell direction": 261.2,
            "swell period": 9.2
        },
        {
            "date": "2024-05-29",
            "surf height": 5.4,
            "swell direction": 274.1,
            "swell period": 10.0
        },
        {
            "date": "2024-05-30",
            "surf height": 5.6,
            "swell direction": 280.4,
            "swell period": 10.4
        },
        {
            "date": "2024-05-31",
            "surf height": 5.4,
            "swell direction": 266.5,
            "swell period": 11.5
        },
        {
            "date": "2024-06-01",
            "surf height": 5.3,
            "swell direction": 236.2,
            "swell period": 12.2
        },
        {
            "date": "2024-06-02",
            "surf height": 6.4,
            "swell direction": 251.3,
            "swell period": 11.4
        },
        {
            "date": "2024-06-03",
            "surf height": 6.4,
            "swell direction": 246.6,
            "swell period": 12.6
        }
    ]
}

This is expected(Santa Cruz is my default location). However, if I wanted JSON output for a different location, like curl localhost:8000?json,loc=nyc, we get an Internal Server Error. It would be ideal to add functionality so we can choose the location of the JSON output

ChristianToro commented 2 months ago

Hey @ryansurf , I would like to work on this issue if it is available.

ryansurf commented 2 months ago

@ChristianToro it is, go for it. Let me know if you run into any issues