leoherzog / cwop.rest

⚡ An easy way to submit weather reports to the NOAA Citizen's Weather Observer Program
https://cwop.rest/
9 stars 1 forks source link

422 Errors #3

Open justinhorner opened 1 month ago

justinhorner commented 1 month ago

I noticed that when sending up a POST request, I would always get a 422 error.

It looks like the culprit was some incorrectly named params. I pushed up a fixed in a fork

After addressing this issue, I noticed I was getting other 422 errors when I would send up data that had '0.0' for some of the value(s) (e.g. windspeedmph). I would think it is considered valid to have 0 windspeed, so I pushed up another commit (https://github.com/justinhorner/cwop.rest/commit/0d7b97beb44137814402f9495ce3e3a0f9e2f579) that checks for null, to ensure the API will accept (valid) 0 values.

I just thought I would share my findings, in case you wanted to merge in the changes to your branch (if not, please feel free to close this 'issue'). I ended up forking, fixing and deploying to my own worker.

Thanks for all the work, this is a great solution for (more easily) pushing up data to CWOP

leoherzog commented 3 weeks ago

Thanks so much for this! I had started to switch the parameter from windspeedmph to windspeed in my testing, but that one snuck out to prod. Nice catch!

tavdog commented 15 hours ago

I'm seeing 422 errors sporadically too. python3 WS8B_to_CWOP.py GET request sent to: https://send.cwop.rest/?id=GW5395&lat=20.938017&long=-156.347942&time=2024-09-12T00:19:50.750121Z&tempf=80&windspeedmph=26.0&windgustmph=32.0&winddir=74 Response status code: 422

i tried shortly after and got 200, then tried shortly after and got a 429

leoherzog commented 3 hours ago

@tavdog Hrm. There are a few cases where the code throws a 422. Can you start logging in your WS8B_to_CWOP.py file not only the HTTP status code, but also the contents of the page when it throws an error? That would tell us if the code thinks that your specified time is invalid or the location is invalid, for example.