--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
gary@stormbird:/usr/share/weewx$ ./wunderfixer --date=2016-05-04 --log=weewx
Using configuration file /etc/weewx/weewx.conf.
Using database binding 'wx_binding', which is bound to database 'archive_mysql'
Unable to open Weather Underground station XXXXXXXXXXX or <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
Could not get Weather Underground data. Exiting.
May 5 20:24:02 stormbird weewx[12779]: wunderfixer: Using weewx configuration file /etc/weewx/weewx.conf.
May 5 20:24:02 stormbird weewx[12779]: wunderfixer: Using database binding 'wx_binding', which is bound to database 'archive_mysql'
May 5 20:24:03 stormbird weewx[12779]: wunderfixer: Unable to open Weather Underground station XXXXXXXXXXX or <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
May 5 20:24:03 stormbird weewx[12779]: wunderfixer: Could not get Weather Underground data. Exiting.
--
I don't know why it's using a connection requiring SSL. All URLs use a simple http connection.
python -V
--
root@rpi3:~# /home/weewx/bin/wunderfixer
Using configuration file /home/weewx/weewx.conf.
Using database binding 'wx_binding', which is bound to database 'archive_mysql'
Unable to open Weather Underground station IVICTORI391 or <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
Could not get Weather Underground data. Exiting.
root@rpi3:~#root@rpi3:~# python -V
Python 2.7.9
root@rpi3:~#I didn't know I had this problem.Every night at 23:57 I have cron run /home/weewx/bin/wunderfixer and no errors appear in any of my logs.
Gary
Frustrating: if the Weatherunderground is going to silently switch http requests to https requests, you'd think they'd get their certificates right.
It really should be fixed on their end. To change things on our end, we'd have to do https requests, then override the certificate verification, as per PEP 476. That seems perverse.
is there any real prospect of them chnaging/fixing the issue? As perverse as the case by case work around in PEP 476 is do we have any other practical choice?
Also interesting that the same URL used by wunderfixer to get station history works without issue in my browser, but I understand, again from googling, that browsers can pull a few tricks to get around a troublesome https site.
Has anybody looked at the WU trust chain enough to figure out how to make the client (wunderfixer) os trust their cert ? That's the only real solution that makes sense to me long-term. The odds of getting WU to do anything are pretty sure to be zero-ish.
--
#---- start patch to disable ssl verification ----## wunderground.com quietly redirects http=>https and# python 2.7.9 turns on strict certificate verification# which breaks the original wunderfixer 0.5.2## long discussion of the internals is at## the following code is taken verbatim fromimport ssltry:_create_unverified_https_context = ssl._create_unverified_contextexcept AttributeError:# Legacy Python that doesn't verify HTTPS certificates by defaultpasselse:# Handle target environment that doesn't support HTTPS verificationssl._create_default_https_context = _create_unverified_https_context#---- end patch to disable ssl verification ----
Thanks for that Vince, your mod worked for me too.It was easy to find where to put it, but in my editor it was about line 65 (for wunderfixer 1.0.0 8/16/15 Published version).
$ sudo nano /usr/local/share/ca-certificates/GTE_CyberTrust_Global_Root.crt
$ sudo update-ca-certificates
$ sudo rm /usr/local/share/ca-certificates/GTE_CyberTrust_Global_Root.crt
$ sudo update-ca-certificates
#!/usr/bin/python
import urllib2
wu_data = urllib2.urlopen("https://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IQUEENSL336&month=5&day=4&year=2016&format=1")
for row in wu_data:
print row
Gary
cd /usr/local/share/ca-certificatessudo update-ca-certificates
--
Liz