Uploading data to WU from raspberry pi (newbie)

  • 1
  • Question
  • Updated 2 months ago
Hi All
I am very new to all this and just wanted someone to say it is or is not possible. I have a raspberry pi weather station and I am trying to upload my data to WU using python. I keep getting "401 unauthorized" errors, however my station ID and password are correct. I then read that the WU API has been retired. Is this my problem?

In WU, I can see my device status is OFFLINE. Is this normal?

Thanks in advance.
Tom
Photo of Tom

Tom

  • 9 Posts
  • 4 Reply Likes

Posted 3 months ago

  • 1
Photo of John Renyard

John Renyard

  • 10 Posts
  • 0 Reply Likes
I use Meteohub and another family member does too
https://wiki.meteohub.de/Buy_Software Download there.  It is very configurable for several sites
(Edited)
Photo of Claude Felizardo

Claude Felizardo

  • 41 Posts
  • 9 Reply Likes
I am using a very old and possibly no longer supported c++ program called OWW that still uses the original upload API.  OWW doesn't handle errors very well so I periodically have to restart which I just had to do but it is uploading correctly right now and I am now seeing my PWS on the wunderground website as well as CWOP, MesoWest and FindU.
Photo of Claude Felizardo

Claude Felizardo

  • 41 Posts
  • 9 Reply Likes
I did a google search for "wunderground upload protocol" and it looks like the first hit leads to a valid URL

https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298

Looks like a 401 means your ID and PASSWORD don't match.  

Other useful links:

https://www.wunderground.com/pws/hardware-software

Photo of Tom

Tom

  • 9 Posts
  • 4 Reply Likes
Thanks guys, however the question still remains, is what I am trying to do possible ? Thanks
Photo of Claude Felizardo

Claude Felizardo

  • 41 Posts
  • 9 Reply Likes
Hi Tom, as I mentioned in my first reply the upload API is working using a C program that has not been modified in years.  I misspoke when I said OWW was written in C++, it's actually written in regular C. I use C++ at work so it must have been muscle memory when I typed that.  It should not matter if you use Python or any other prgramming language.  

I do plan to redo my PWS system probably using an old RaspPi I have lying around and will probably use Python unless I can find another package that already does most of what I want to do.  

What has changed is the download API is no longer valid.  I was able to find an update for my Logitech Media Server that just worked but my ElectricImp program stopped working and I haven't had time to fix it.

If you are getting a 401 while trying to do an upload, then either your ID is wrong or your PASSWORD is incorrect.  

Claude
Photo of Tom

Tom

  • 9 Posts
  • 4 Reply Likes
Thanks Claude, I got it to work !
My misunderstand, the password is not my login password, it is the "key" in the devices section. My bad. Thanks to ALL !
Photo of Paul Hutch

Paul Hutch

  • 21 Posts
  • 7 Reply Likes
The official documentation says it should be a GET request, not a POST request and it works when I've tried it.
https://support.weather.com/s/article/PWS-Upload-Protocol?language=en_US
Here is how to create a Personal Weather Station update to wunderground.com:
Background
To upload a weather condition, you make a standard HTTP GET request with the ID, PASSWORD and weather conditions as GET parameters


(Edited)
Photo of Tom

Tom

  • 9 Posts
  • 4 Reply Likes
Thanks Paul, I tried the 'GET' and it works!
Photo of Paul Hutch

Paul Hutch

  • 21 Posts
  • 7 Reply Likes
I still don't fully understand why CGI GET works for uploading or why it would ever be used instead a CGI POST.

When I saw the instructions I vaguely remembered learning last century that this was a common weirdness to CGI. I then looked for a good modern explanation but never did find one. I only found confirmation that both GET and POST can be used to provide data to a CGI server.
Photo of Claude Felizardo

Claude Felizardo

  • 41 Posts
  • 9 Reply Likes
When developing a web service it is very easy to use the GET command because you can just append the data to the URI whereas a POST requires that the data be put into the body of the request which requires more code to create which is easy if you using a library.  With a GET command you can test fom a command line program like WGET or CURL.
(Edited)
Photo of Paul Hutch

Paul Hutch

  • 21 Posts
  • 7 Reply Likes
Thanks for the info Claude!
Photo of Bruce Brownlee

Bruce Brownlee

  • 4 Posts
  • 3 Reply Likes
Dont know if this it solved or not.
I posted a port I did of an old Davis Stations python app.
https://github.com/brownleeb/RPi-Station-Davis

I have since updated to use Python Requests instead of the supplied fhttplib.  
On my long list of things to do is to go through that code and clean out/update to current python libs.