Hi Gareth.

I've been puzzled by this and have been doing some debugging. I started 
with reproducing your code above in my own copy of wunderfixer. I began by 
trying to see what the actual contents of the error is, and that led me to 
realize that the exception handler in that section of code isn't where the 
exception is being thrown. If you look in the vicinity of line 207, you 
should see something like the following

   try:
        # Get all the time stamps on the Weather Underground for the given 
day:
        wunder_results = wunder.getDayTimeStamps(date_date)
    #except Exception as e: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
I commented out
    except  urllib2.HTTPError, error: 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< I added
# here
        contents = error.read() <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< I 
added
        print contents              
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< I added
        wlog.slog(syslog.LOG_ERR, "Could not get Weather Underground data. 
Exiting.")
        exit("Could not get Weather Underground data. Exiting.")


This causes the actual web page (the HTML content that describes the actual 
error) to be printed on the console. in my case, the error looks like this

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
 
You don't have permission to access 
"http&#58;&#47;&#47;www&#46;wunderground&#46;com&#47;weatherstation&#47;WXDailyHistory&#46;asp&#63;"
 
on this server.<P>
Reference&#32;&#35;18&#46;3f75d917&#46;1560296045&#46;2172682b
</BODY>
</HTML>

Could not get Weather Underground data. Exiting.


What this tells me is that something is wrong with my station 
configuration. And yet, my periodic posts are sent correctly to WU. Hmmmm. 

I know that WU was rebuilt not long ago. I wonder if that might be part of 
the problem. Unfortunately, I'm not much of  python guy so I'm rather on 
the slow side in debugging.

I'll post more as I find it.

 

 


On Friday, June 7, 2019 at 5:23:29 PM UTC-7, Gareth Hunt wrote:
>
> Greetings,
>
> [Still a newbie user.]
>
> I live in rural USA where a landline DSL will probably be available some 
> time after Hell freezes over.  So I have to rely on a satellite link.  Not 
> surprisingly, this fails when there are adverse atmospheric conditions.  
> There were thunderstorms for several hours on June 7.  So wunderfixer to 
> the rescue!  However, it failed.  Here is the code snippet with my added 
> print statement in class Wunderstation.
>
>         _url = "
> http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=%s&"\
>         "month=%d&day=%d&year=%d&format=1" % (self.station, 
> dayRequested_tt[1], dayRequested_tt[2], dayRequested_tt[0]) 
>         print _url   # My addition
>         
>         try :
>             # Hit the weather underground site:
>             _wudata = urllib2.urlopen(_url)
>         except urllib2.URLError as e :
>             print >>sys.stderr, "Unable to open Weather Underground 
> station " + self.station, " or ", e
>
> This gave:
>
> bin$ ./my.wunderfixer 
> Using configuration file /home/weewx/weewx.conf.
> Using database binding 'wx_binding', which is bound to database 
> 'archive_sqlite'
>
> http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KVASCOTT14&month=6&day=7&year=2019&format=1
> Unable to open Weather Underground station KVASCOTT14  or  HTTP Error 403: 
> Forbidden
> Could not get Weather Underground data. Exiting.
>
> However, when I copied and pasted the printed http address into my 
> browser, everything was fine.  I could see all of the reported records with 
> the expected data gaps.  I did not get HTTP Error 403 (i.e., e).
>
> So I have some (hopefully trivial) permission error with my access to 
> Wunderground.  Can somebody suggest what it is and how I get it fixed?
>
> Thanks,
> Gareth.
>

-- 
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/79855566-ce8e-4fe1-a797-59f97aad2897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to