Forecast 3.3.2

209 views
Skip to first unread message

Phil Owers

unread,
Apr 8, 2020, 10:11:31 AM4/8/20
to weewx-user
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

mwall

unread,
Apr 8, 2020, 10:29:10 AM4/8/20
to weewx-user
the 3.x series of weewx-forecast does not work with python3 or weewx4

for now you should use weewx3 and python2

you can expect an update to the weewx-forecast extension soon after weewx4 comes out of beta

William Burton

unread,
Apr 8, 2020, 3:13:10 PM4/8/20
to weewx-user
Hello,

If there was a development branch on github, I'd be happy to do some testing under WeeWX 4 and Python 3.

-Bill

John Kline

unread,
Apr 8, 2020, 3:30:25 PM4/8/20
to William Burton, weewx-user
If you want while waiting for Matthew to update:


It requires WeeWX 4 and works with Python 2 and 3.

I’ve been running it for months and Vince (on this mailing list) has also been running it.

On Apr 8, 2020, at 12:13 PM, William Burton <bburt...@gmail.com> wrote:

Phil Owers

unread,
Apr 8, 2020, 4:53:53 PM4/8/20
to weewx...@googlegroups.com
Thanks John.  Will give it ago
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/C370F50B-9049-4D55-BB89-DB16B05C1C86%40johnkline.com.

Phil Owers

unread,
Apr 9, 2020, 2:56:59 PM4/9/20
to weewx-user
Hi John
Just need to tweek the forecast.py so it can download from the UK Met Office.
They changed a few weeks ago to only excepting   'User-Agent', 'Mozilla/5.0 

In the forecast.py you sent me it had 
response = six.moves.urllib.request.urlopen(u)
return response.read().decode('utf-8')

My previous forecast.py I used

req = urllib2.Request(u)
req.add_header('User-Agent', 'Mozilla/5.0')
response = urllib2.urlopen(req)
return response.read()
But I cant get that to work any chance you could help out please.   Sorry to be a pain
Phil

John Kline

unread,
Apr 9, 2020, 4:11:33 PM4/9/20
to weewx...@googlegroups.com
Hi Phil,

Would you please try the following:
                user_agent = {'User-Agent': 'Mozilla/5.0'}
                requester = six.moves.urllib.request.Request(u, headers=user_agent)
                response = request.urlopen(requester)
                return response.read().decode('utf-8')

If that doesn’t work, I can get it working tonight (day job getting in the way).
Also, it would be helpful if you could add:
before the call and tell me what the log says is the URL.
I believe I can’t get a UK Met Office forecast in California.


On Apr 9, 2020, at 11:57 AM, Phil Owers <philip....@gmail.com> wrote:


--
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.

Phil Owers

unread,
Apr 9, 2020, 4:35:59 PM4/9/20
to weewx-user
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:

John Kline

unread,
Apr 9, 2020, 5:31:11 PM4/9/20
to weewx...@googlegroups.com
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 <philip....@gmail.com> wrote:


--
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.

John Kline

unread,
Apr 9, 2020, 5:51:45 PM4/9/20
to weewx...@googlegroups.com
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 <jo...@johnkline.com> wrote:



Phil Owers

unread,
Apr 9, 2020, 6:26:45 PM4/9/20
to weewx-user
Apr  9 23:11:21 raspberrypi weewx[1898] ERROR user.forecast: UKMOThread: UKMO: failed attempt 3 to download forecast: <urlopen error [Errno -3] Temporary failure in name resolution>

Hope that's what you need 

I could set up a temp api / location for UKMO if that would help.  But its late here so it would be later tomorrow 
Phil


On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote:

John Kline

unread,
Apr 9, 2020, 6:30:23 PM4/9/20
to weewx...@googlegroups.com
Hi Phil,

I signed up for an API key and it it working for me.  With the code I sent you (that is, the second code snippet I sent).  The temporary failure in name resolution you are seeing is just that, temporary.

Here’s my log once I had a real API key:

Apr  9 15:25:05 judy weewx[29939] INFO user.forecast: UKMOThread: UKMO: got 34 forecast records
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO weewx.manager: Added record 2020-04-09 15:25:05 PDT (1586471105) to database 'forecast.sdb'
Apr  9 15:25:05 judy weewx[29939] INFO user.forecast: UKMOThread: UKMO: saved 34 forecast records

On Apr 9, 2020, at 3:26 PM, Phil Owers <philip....@gmail.com> wrote:


--
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.

Phil Owers

unread,
Apr 9, 2020, 7:49:43 PM4/9/20
to weewx-user
John
Mine keeps saying temp temporary failure in name. Could you send me your forecast.py file please
Phil 

On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote:

John Kline

unread,
Apr 9, 2020, 9:05:58 PM4/9/20
to weewx...@googlegroups.com
Hi Phil,

I committed the change.  Please pull again.

None of the code is going to help you with name resolution; but it doesn’t hurt to try anyway.

Afterwards, try resolving the machine name in the UKMO url on the same machine that WeeWX is running (with host or nslookup).

On Apr 9, 2020, at 4:49 PM, Phil Owers <philip....@gmail.com> wrote:


--
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.

John Kline

unread,
Apr 10, 2020, 12:34:50 AM4/10/20
to weewx...@googlegroups.com
Hi Phil,

Please run the following command (it is a single line), substituting your API key, and reply with the output you receive.


For me, with —user-agent not specified, with —user-agent ‘foo’ specified, or with any other user-agent specified, the command works.

Web searches do show that, from time to time, UKMO has issues and there is anecdotal evidence that changing the user-agent sometimes helps.  I wonder if your original problem, where you needed to change the user-agent, was one of those times.

It will also be interested to see if you can resolve datapoint.metoffice.gov.uk.  In addition to that above, please also include the output of:


I will revert the change I made to specify a user-agent if it turns out it is not needed (which currently appears to be the case).

John

On Apr 9, 2020, at 6:05 PM, John Kline <jo...@johnkline.com> wrote:



Phil Owers

unread,
Apr 10, 2020, 4:47:04 AM4/10/20
to weewx...@googlegroups.com
That gives me a display of siterep and then the list of param name units feels like etc and then the info. So works.  Its also the same on my working pi.  So that looks good
Phil

Phil Owers

unread,
Apr 10, 2020, 5:37:01 AM4/10/20
to weewx-user
pi@raspberrypi:~ $ host datapoint.metoffice.gov.uk
datapoint.metoffice.gov.uk is an alias for datapoint.metoffice.gov.uk.edgesuite.net.
datapoint.metoffice.gov.uk.edgesuite.net is an alias for a978.r.akamai.net.
a978.r.akamai.net has address 213.123.252.58
a978.r.akamai.net has address 213.123.252.56
pi@raspberrypi:~ $
{"SiteRep":{"Wx":{"Param":[{"name":"F","units":"C","$":"Feels Like Temperature"},{"name":"G","units":"mph","$":"Wind Gust"},{"name":"H","units":"%","$":"Screen Relative Humidity"},{"name":"T","units":"C","$":"Temperature"},{"name":"V","units":"","$":"Visibility"},{"name":"D","units":"compass","$":"Wind Direction"},{"name":"S","units":"mph","$":"Wind Speed"},{"name":"U","units":"","$":"Max UV Index"},{"name":"W","units":"","$":"Weather Type"},{"name":"Pp","units":"%","$":"Precipitation Probability"}]},"DV":{"dataDate":"2020-04-10T07:00:00Z","type":"Forecast","Location":{"i":"3772","lat":"51.479","lon":"-0.449","name":"HEATHROW","country":"ENGLAND","continent":"EUROPE","elevation":"25.0","Period":[{"type":"Day","value":"2020-04-10Z","Rep":[{"D":"NE","F":"9","G":"13","H":"78","Pp":"0","S":"4","T":"10","V":"MO","W":"2","U":"0","$":"180"},{"D":"NE","F":"8","G":"18","H":"87","Pp":"0","S":"4","T":"9","V":"MO","W":"1","U":"1","$":"360"},{"D":"E","F":"12","G":"11","H":"71","Pp":"0","S":"9","T":"14","V":"MO","W":"1","U":"3","$":"540"},{"D":"ESE","F":"19","G":"13","H":"51","Pp":"0","S":"9","T":"21","V":"GO","W":"1","U":"5","$":"720"},{"D":"ESE","F":"21","G":"16","H":"44","Pp":"0","S":"11","T":"23","V":"GO","W":"1","U":"2","$":"900"},{"D":"ESE","F":"18","G":"18","H":"50","Pp":"0","S":"11","T":"20","V":"GO","W":"1","U":"1","$":"1080"},{"D":"E","F":"14","G":"13","H":"65","Pp":"0","S":"7","T":"15","V":"GO","W":"0","U":"0","$":"1260"}]},{"type":"Day","value":"2020-04-11Z","Rep":[{"D":"E","F":"12","G":"11","H":"76","Pp":"0","S":"4","T":"12","V":"GO","W":"0","U":"0","$":"0"},{"D":"E","F":"11

There is more but it only copied what was on the screen I then usedmy location and got 
i@raspberrypi:~ $ curl --user-agent 'foo' "http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/354731?res=3hourly&key=8f916e8d-7477-4198-8ecc-ae764ff7bb84"
{"SiteRep":{"Wx":{"Param":[{"name":"F","units":"C","$":"Feels Like Temperature"},{"name":"G","units":"mph","$":"Wind Gust"},{"name":"H","units":"%","$":"Screen Relative Humidity"},{"name":"T","units":"C","$":"Temperature"},{"name":"V","units":"","$":"Visibility"},{"name":"D","units":"compass","$":"Wind Direction"},{"name":"S","units":"mph","$":"Wind Speed"},{"name":"U","units":"","$":"Max UV Index"},{"name":"W","units":"","$":"Weather Type"},{"name":"Pp","units":"%","$":"Precipitation Probability"}]},"DV":{"dataDate":"2020-04-10T07:00:00Z","type":"Forecast","Location":{"i":"354731","lat":"52.9456","lon":"1.212","name":"SHERINGHAM (BEACH)","country":"ENGLAND","continent":"EUROPE","elevation":"0.0","Period":[{"type":"Day","value":"2020-04-10Z","Rep":[{"D":"ESE","F":"5","G":"13","H":"90","Pp":"5","S":"11","T":"8","V":"MO","W":"7","U":"0","$":"180"},{"D":"ESE","F":"6","G":"13","H":"87","Pp":"5","S":"11","T":"8","V":"GO","W":"7","U":"1","$":"360"},{"D":"ESE","F":"7","G":"16","H":"84","Pp":"4","S":"11","T":"9","V":"GO","W":"7","U":"3","$":"540"},{"D":"ESE","F":"10","G":"18","H":"66","Pp":"4","S":"16","T":"13","V":"GO","W":"7","U":"4","$":"720"},{"D":"ESE","F":"11","G":"20","H":"61","Pp":"5","S":"16","T":"14","V":"GO","W":"7","U":"2","$":"900"},{"D":"SE","F":"10","G":"16","H":"72","Pp":"4","S":"9","T":"12","V":"GO","W":"7","U":"1","$":"1080"},{"D":"SE","F":"7","G":"20","H":"77","Pp":"4","S":"9","T":"9","V":"GO","W":"7","U":"0","$":"1260"}]},{"type":"Day","value":"2020-04-11Z","Rep":[{"D":"SSE","F":"7",
Again there is more
Phil


On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote:

Phil Owers

unread,
Apr 10, 2020, 5:52:44 AM4/10/20
to weewx-user
But looking in the log a little late I see this
Apr 10 10:39:24 raspberrypi weewx[626] INFO user.forecast: UKMOThread: UKMO: download forecast from 'http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/354731?res=3hourly&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXf051'
Apr 10 10:39:24 raspberrypi weewx[626] INFO weewx.manager: Added record 2020-04-10 10:30:00 BST (1586511000) to daily summary in 'weewx.sdb'
Apr 10 10:39:24 raspberrypi weewx[626] ERROR user.forecast: UKMOThread: UKMO: failed attempt 1 to download forecast: HTTP Error 403: Forbidden
Apr 10 10:39:24 raspberrypi weewx[626] ERROR user.forecast: UKMOThread: UKMO: failed attempt 2 to download forecast: HTTP Error 403: Forbidden
Apr 10 10:39:24 raspberrypi weewx[626] ERROR user.forecast: UKMOThread: UKMO: failed attempt 3 to download forecast: HTTP Error 403: Forbidden
Apr 10 10:39:24 raspberrypi weewx[626] ERROR user.forecast: UKMOThread: UKMO: failed to download forecast
Apr 10 10:39:24 raspberrypi weewx[626] ERROR user.forecast: UKMOThread: UKMO: no forecast data for 354731 from http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/
Apr 10 10:39:24 raspberrypi weewx[626] INFO user.forecast: UKMOThread: UKMO: download forecast from 'http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/354731?res=3hourly&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXf051'

On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote:

John Kline

unread,
Apr 10, 2020, 10:11:44 AM4/10/20
to weewx...@googlegroups.com
Hi Phil,

Are you absolutely certain that the key you used for the command you ran below is the same as what is in your weewx.conf file?  I ask because the forbidden error is what I see when I don’t use a valid key.

If they keys agree, please try again for the command line, but use your location instead of the one I gave you.  That is, use 354731.

Do you see the download failures in log every time or just some times?

Would you point me to the information about changing the User-agent?

Are you running with Python 2 or 3?

On my end, I switched to your location and its running fine.  I’ll leave it running.


On Apr 10, 2020, at 2:52 AM, Phil Owers <philip....@gmail.com> wrote:


--
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.

Phil Owers

unread,
Apr 10, 2020, 10:32:15 AM4/10/20
to weewx-user
I raised a second API to see if that was the problem hence why you got 2 different ones.  The following is from the key ending in f051.   Both keys acted the same.

{"SiteRep":{"Wx":{"Param":[{"name":"F","units":"C","$":"Feels Like Temperature"},{"name":"G","units":"mph","$":"Wind Gust"},{"name":"H","units":"%","$":"Screen Relative Humidity"},{"name":"T","units":"C","$":"Temperature"},{"name":"V","units":"","$":"Visibility"},{"name":"D","units":"compass","$":"Wind Direction"},{"name":"S","units":"mph","$":"Wind Speed"},{"name":"U","units":"","$":"Max UV Index"},{"name":"W","units":"","$":"Weather Type"},{"name":"Pp","units":"%","$":"Precipitation Probability"}]},"DV":{"dataDate":"2020-04-10T09:00:00Z","type":"Forecast","Location":{"i":"354731","lat":"52.9456","lon":"1.212","name":"SHERINGHAM (BEACH)","country":"ENGLAND","continent":"EUROPE","elevation":"0.0","Period":[{"type":"Day","value":"2020-04-10Z","Rep":[{"D":"ESE","F":"6","G":"13","H":"87","Pp":"5","S":"11","T":"8","V":"GO","W":"7","U":"1","$":"360"},{"D":"ESE","F":"9","G":"18","H":"79","Pp":"4","S":"9","T":"11","V":"GO","W":"7","U":"3","$":"540"},{"D":"ESE","F":"10","G":"18","H":"68","Pp":"4","S":"16","T":"13","V":"GO","W":"7","U":"4","$":"720"},{"D":"ESE","F":"12","G":"18","H":"60","Pp":"4","S":"13","T":"15","V":"GO","W":"7","U":"2","$":"900"},{"D":"ESE","F":"10","G":"13","H":"73","Pp":"4","S":"9","T":"11","V":"GO","W":"7","U":"1","$":"1080"},{"D":"SE","F":"7","G":"20","H":"78","Pp":"3","S":"9","T":"9","V":"GO","W":"7","U":"0","$":"1260"}]},{"type":"Day","value":"2020-04-11Z","Rep":[{"D":"SE","F":"7","G":"20","H":"79","Pp":"4","S":"9","T":"9","V":"GO","W":"7","U":"0","$":"0"},{"D":"SSE","F":"6","G":"22","H":"82","Pp":"4","S":"9","T":"9","V":"GO","W":"7","U":"0","$":"180"},{"D":"SSE","F":"6","G":"22","H":"81","Pp":"0","S":"9","T":"9","V":"GO","W":"1","U":"1","$":"360"},{"D":"S","F":"13","G":"18","H":"62","Pp":"0","S":"11","T":"15","V":"VG","W":"1","U":"3","$":"540"},{"D":"S","F":"17","G":"18","H":"50","Pp":"0","S":"11","T":"19","V":"VG","W":"1","U":"5","$":"720"},{"D":"SSW","F":"18","G":"16","H":"49","Pp":"7","S":"9","T":"20","V":"VG","W":"3","U":"2","$":"900"},{"D":"S","F":"16","G":"16","H":"61","Pp":"36","S":"9","T":"17","V":"GO","W":"3","U":"1","$":"1080"},{"D":"SW","F":"13","G":"13","H":"77","Pp":"8","S":"7","T":"14","V":"VG","W":"7","U":"0","$":"1260"}]},{"type":"Day","value":"2020-04-12Z","Rep":[{"D":"WSW","F":"11","G":"11","H":"84","Pp":"10","S":"7","T":"12","V":"VG","W":

Download failures are every time, hence why the forecast.sdb is empty.
Im using a Python 3 only machine with your forecast.py file from your link you gave me the other day. The weewx version is V4.0.0.b18 and always fails.
My main machine runs weewx Version 3.9.2 and downloads from the met office and uses forecast 3.3.2 forecast.py that was modified to use mozilla5.0 to work and works fine.
About a couple of months ago UKMO started to fail and via email they suggested to use mozilla5.0. There were others around the UK who also had problems it wasn't just me. 
It failed HTTP Error 403: Forbidden which is the same as your forecast.py hence why I think it is the same problem.
 I cant remember the person name, its on this forum somewhere, who changed his code form
try:
                response
= urllib2.urlopen(u)
               
return response.read()
to 
try:

                req
= urllib2.Request(u)
                req
.add_header('User-Agent', 'Mozilla/5.0')

                response
= urllib2.urlopen(req)
               
return response.read()
This changed worked and we have been using it ever since.
Phil


On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote:

John Kline

unread,
Apr 10, 2020, 11:41:11 AM4/10/20
to weewx...@googlegroups.com
Hi Phil,

OK, from the machine in question running WeeWX 4.0b18, please run:

PYTHONPATH=/home/weewx/bin python3 /home/weewx/bin/user/forecast.py --method UKMO --action download --loc 354731 --api-key XXXXXXXXXXXXXXXXXXXXXXXX

Fill in your api-key and adjust ‘/home/weewx’ to your weewx install location.

Cheers,
John

On Apr 10, 2020, at 7:32 AM, Phil Owers <philip....@gmail.com> wrote:


--
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.

Phil Owers

unread,
Apr 10, 2020, 12:28:52 PM4/10/20
to weewx-user
At the cursor
pi@raspberrypi:/home/weewx $ PYTHONPATH=/home/weewx/bin python3 /home/weewx/bin/user/forecast.py --method UKMO --action download --loc 354731 --api-key xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxf051
None
pi@raspberrypi:/home/weewx $ 

In the log
Apr 10 17:17:12 raspberrypi forecast[3785] INFO __main__: MainThread: UKMO: download forecast from 'http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/354731?res=3hourly&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXf051'
Apr 10 17:17:32 raspberrypi forecast[3785] ERROR __main__: MainThread: UKMO: failed attempt 1 to download forecast: <urlopen error [Errno -3] Temporary failure in name resolution>
Apr 10 17:17:52 raspberrypi forecast[3785] ERROR __main__: MainThread: UKMO: failed attempt 2 to download forecast: <urlopen error [Errno -3] Temporary failure in name resolution>
Apr 10 17:18:01 raspberrypi kernel: [23984.559200] brcmfmac: brcmf_run_escan: error (-110)
Apr 10 17:18:01 raspberrypi kernel: [23984.559217] brcmfmac: brcmf_cfg80211_scan: scan error (-110)
Apr 10 17:18:12 raspberrypi forecast[3785] ERROR __main__: MainThread: UKMO: failed attempt 3 to download forecast: <urlopen error [Errno -3] Temporary failure in name resolution>
Apr 10 17:18:12 raspberrypi forecast[3785] ERROR __main__: MainThread: UKMO: failed to download forecast


Phil
On Wednesday, April 8, 2020 at 3:11:31 PM UTC+1, Phil Owers wrote:

John Kline

unread,
Apr 10, 2020, 12:55:07 PM4/10/20
to weewx...@googlegroups.com
My guess is that the Akamai servers that you are being directed to are acting up when you are getting the denied messages.

The temporary name resolution could also be Akamai dns problems.

Immediately after you see the temporary failure, does running ‘host datapoint.metoffice.gov.uk‘ resolve?

Just grasping at straws for these remaining questions:
What raspberry pi, what version of Raspbian, what version of Py3?  (I’m running an up to date RPi4 with Buster 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux and Python 3.7.3 on my end to try this and all is working fine.)

On Apr 10, 2020, at 9:28 AM, Phil Owers <philip....@gmail.com> wrote:


--
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.

Phil Owers

unread,
Apr 10, 2020, 1:22:41 PM4/10/20
to weewx...@googlegroups.com
Yes im running the latest buster on an RPI4.  Running host after running PYTHONPATH just replied connection timed out , no servers could be reached.  Yet my RPI3 works perfectly ok. 

John Kline

unread,
Apr 10, 2020, 1:25:08 PM4/10/20
to weewx...@googlegroups.com
This is telling me that your issues are not with WeeWX and the forecast plugin.

Do you have another machine you could try this on?  Running the simulator driver would be just fine for this excersize.

On Apr 10, 2020, at 10:22 AM, Phil Owers <philip....@gmail.com> wrote:



Phil Owers

unread,
Apr 10, 2020, 1:53:23 PM4/10/20
to weewx...@googlegroups.com
Just getting another SD Card loaded with everything fresh. Then tomorrow will start again on a spare pi3. Will keep you posted.  Phil

John Kline

unread,
Apr 10, 2020, 4:45:12 PM4/10/20
to weewx...@googlegroups.com
Hi Phil,

I do have some good news.

I locally reverted my change to add the user-agent and duplicated the 403: Forbidden.  I then put back the change, and it again works.

As such, I’ll keep that change.  Thanks for making me aware of it.  I’m hoping your fresh install on another machine will work better for you tomorrow.

Cheers,
John

On Apr 10, 2020, at 10:53 AM, Phil Owers <philip....@gmail.com> wrote:



Phil Owers

unread,
Apr 11, 2020, 7:07:49 AM4/11/20
to weewx-user
Hi John
Ive just downloaded your new weewx-forecast-master and downloaded to my Downloads directory (weewx-forecast-master.gz)
Then sudo ./bin/wee_extension --install /home/pi/Downloads/weewx-forecast-master.gz     (must be in home/weewx directory and it works for other install packages)
It doesn't install and I get 'readerror: file could not be opened  successfully
I cant remember how I did this last time and to make sure I install correctly could you confirm the correct way of installing so to eliminate any mistakes I could make.
Cheers Phil 

John Kline

unread,
Apr 11, 2020, 7:43:39 AM4/11/20
to weewx...@googlegroups.com
Personally, I have these repositories cloned, I go to the root of the repository and run:
sudo /home/weewx/bin/wee_extension --install .

I think what you are doing should work.  I don’t know what to tell you other than, if you are sure you got the file name correct, try downloading again.

Are you sure you have a good SD card?

On Apr 11, 2020, at 4:07 AM, Phil Owers <philip....@gmail.com> wrote:


--
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.

Phil Owers

unread,
Apr 11, 2020, 10:09:13 AM4/11/20
to weewx-user
John
I did have the filename wrong, your file is a zip file so as soon as I changed it to weewx-forecast-master.zip wee_extension installed correctly and Im
now downloading from UKMO.
So thanks for your help and patience

John Kline

unread,
Apr 11, 2020, 11:28:43 AM4/11/20
to weewx...@googlegroups.com
Hi Phil,

I’m very happy to hear that it is working.

On Apr 11, 2020, at 7:09 AM, Phil Owers <philip....@gmail.com> wrote:


--
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.
Reply all
Reply to author
Forward
0 new messages