OK, the URL I asked you to send will have your API key, so don’t send that.
I tried the code I sent with an API key of 123 (i.e., invalid) and a location code of 3772 (which I got from the HEATHROW_1 test in the plugin). The results I get are below. Which obviously didn’t work with an invalid API key. Will be interested to see what results you get with a valid API key. When you send results, don’t send the &key= part of the URL. Apr 9 14:45:04 judy weewx[31798] INFO user.forecast: UKMOThread: UKMO: download forecast from 'http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/3772?res=3hourly&key=123' Apr 9 14:45:05 judy weewx[31798] ERROR user.forecast: UKMOThread: UKMO: failed attempt 1 to download forecast: HTTP Error 403: Forbidden Apr 9 14:45:05 judy weewx[31798] ERROR user.forecast: UKMOThread: UKMO: failed attempt 2 to download forecast: HTTP Error 403: Forbidden Apr 9 14:45:06 judy weewx[31798] ERROR user.forecast: UKMOThread: UKMO: failed attempt 3 to download forecast: HTTP Error 403: Forbidden Apr 9 14:45:06 judy weewx[31798] ERROR user.forecast: UKMOThread: UKMO: failed to download forecast Apr 9 14:45:06 judy weewx[31798] ERROR user.forecast: UKMOThread: UKMO: no forecast data for 3772 from http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/ > On Apr 9, 2020, at 2:31 PM, John Kline <[email protected]> wrote: > > > OK, one more try while I’m waiting for the URL from you. I forgot to prefix > request with six.moves.urllib. > > user_agent = {'User-Agent': 'Mozilla/5.0'} > requester = six.moves.urllib.request.Request(u, headers=user_agent) > response = six.moves.urllib.request.urlopen(requester) > return response.read().decode('utf-8') > >>> On Apr 9, 2020, at 1:36 PM, Phil Owers <[email protected]> wrote: >>> >> >> John >> That was quick >> It failed in the syslog NameError : name 'request' is not defined >> I will put log.info(u) before the first line if that helps >> and thanks for helping Phil >> >>> On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote: >>> Just downloaded the forecast extension which was 3.3.2.which I think is the >>> latest on to a python 3 only machine (weewx 4.0.0b18) and it fails >>> forecast.py Line 567 except OSError , e; with an underscore under the , >>> Just wondered if anybody else has had this. >>> Cheers Phil >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/91a060e1-ba96-40fd-99ea-a03a84b1254f%40googlegroups.com. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/969FC96E-E3E9-4B48-948D-4C39066C219D%40johnkline.com.
