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 <[email protected]> wrote:
> 
> 
> 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.
> 
> pi@raspberrypi:~ $ curl --user-agent 'foo' 
> "http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/354731?res=3hourly&key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxf051";
> {"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:
>> 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/d4bbeec7-b162-46de-b0c9-65f8ec4ea221%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/E8D34422-6795-4688-89E7-4582F0A1ABEB%40johnkline.com.

Reply via email to