Pirate-Weather / pirateweather

Code and documentation for the Pirate Weather API
Apache License 2.0
670 stars 30 forks source link

Excluding sections no longer works #108

Closed jgrahamc closed 6 months ago

jgrahamc commented 1 year ago

This was not the case previously. If I do:

curl "https://api.pirateweather.net/forecast/API_KEY/51,1?units=si&tz=precise&exclude=currently,minutely,hourly,daily,alerts"

I get the following response:

{ "currently" : { "apparentTemperature" : 66.22, "cloudCover" : 1, "dewPoint" : 53.87, "humidity" : 0.74, "icon" : "cloudy", "nearestStormBearing" : 0, "nearestStormDistance" : 0, "ozone" : 279.45, "precipIntensity" : 0.0003, "precipIntensityError" : 0, "precipProbability" : 0, "precipType" : "rain", "pressure" : 1008.91, "summary" : "Cloudy", "temperature" : 62.01, "time" : 1695928920, "uvIndex" : 0, "visibility" : 10, "windBearing" : 189, "windGust" : 23.71, "windSpeed" : 13.11 }, "elevation" : 115, "flags" : { "nearest-station" : 0, "sourceTimes" : { "gefs" : "2023-09-28 06:00:00", "gfs" : "2023-09-28 12:00:00" }, "sources" : [ "ETOPO1", "gfs", "gefs" ], "units" : "us", "version" : "V1.5.5" }, "latitude" : 51, "longitude" : 1, "offset" : 1, "timezone" : "Etc/GMT" }

Previously, I did not get the currently section and this is now causing my code to blow up because I have limited memory allocation.

cloneofghosts commented 1 year ago

From my testing it seems that the first item in the exclude isn't actually getting excluded and alerts cannot be excluded at all. For now a workaround would be to set your excludes like this &exclude=flags,currently,minutely,hourly,daily,alerts and it will exclude the currently section until this gets fixed.

Will tag @alexander0042 here as well so he can investigate.

jgrahamc commented 1 year ago

Ah. Thanks. That's helpful to know. Since I am using the API on some embedded devices where memory is small being able to exclude is pretty vital! Unfortunately, working around this tonight means a software update to the devices so crossing my fingers the API can be fixed!

alexander0042 commented 1 year ago

Hi, really sorry about this, and thank you for posting this issue! What's happening is that AWS is currently having an issue in the availability zone I use for my front end proxy, and so requests are getting dropped. In a piece of good news, the fallback system I put in place worked, and so data is still flowing over the other pathway... however, it introduced this regression since the proxy parsing is ever so slightly different. Investigating now, and will hopefully have a fix shortly!

alexander0042 commented 1 year ago

Ok, and we're back! Turns out it was just a switch in my API gateway config, so much easier than anticipated (for once). Let me know if you're still having issues, and again, I'm sorry for the problem. I take uptime pretty seriously after a few outages last year, so while I'm happy the fallback worked in this case, it doesn't help much if it isn't working properly!

jgrahamc commented 1 year ago

Ah. Thanks. I'll close this out.

lollita commented 6 months ago

https://api.pirateweather.net/forecast/{id}/38.1105%2C15.6613?exclude=flags,minutely&units=ca again not exclude for me also if prefix flags,

cloneofghosts commented 6 months ago

Looks like excluding sections broke as part of the v2 update. Will tag @alexander0042 to look into this.

gquiring commented 6 months ago

Same here, I'm new to Pirate-Weather and was wondering why my syntax was not working with exclude. I wish the API would just have syntaxes like many others where it's /forecast/current if the dev has problems parsing the options.

cloneofghosts commented 6 months ago

The excludes parameter worked in API version 1.5.6. In preparation of making the code open source the API code was entirely rewritten for version 2.0.1. The issue with excludes not working will get fixed.

jgrahamc commented 6 months ago

Yep. I see this too. Same as before causes me out of memory problems because I'm using a restricted amount of memory for JSON decoding.

gquiring commented 6 months ago

Same here my program blows up because the response string is 34k long!!!

cloneofghosts commented 6 months ago

There's not much I can do on my end but I'll trying pinging @alexander0042 again to see if he can take a look this morning. Unfortunately I haven't found a workaround so you'll have to wait until this gets fixed.

alexander0042 commented 6 months ago

So sorry about this! Investigating now, fix will be shortly

alexander0042 commented 6 months ago

Ok, fix is live in 2.0.2, you'll see it roll out in 15 minutes or so! Really sorry for missing this during 2.0 testing, and I appreciate the patience while I fix it

jgrahamc commented 6 months ago

Working here.

cloneofghosts commented 6 months ago

Can also confirm that everything is now working as expected so will close this issue.