Google Weather API 403 Error [duplicate]

This is related to a change / outage of the service. See: http://status-dashboard.com/32226/47728

enter image description here

I have been using Google’s Weather API for over a year to feed a phone server so that the PolyCom phones receive a weather page. It has run error free for over a year. As of August 7th 2012 there have been frequent intermittent 403 errors.

I make a hit of the service once per hour (As has always been the case) so I don’t think frequency of request is the issue. More likely the intermittent nature of the 403 is related to the partial roll-out of a configuration change or a CDN change at Google.

The Google Weather API isn’t really a published API. It was an internal service apparently designed for use on iGoogle so the level of support is uncertain. I tweeted googleapis yesterday and received no response.

It may be better to switch to a promoted weather API such as:
WUnderground Weather or
Yahoo Weather.

I have added the following ‘unless defined’ error handling perl code myself yesterday to cope with this but if the problem persists I will switch to a more fully supported service:

my $url = "http://www.google.com/ig/api?weather=" . $ZipCode ;

my $tpp = XML::TreePP->new();
my $tree = $tpp->parsehttp( GET => $url );

my $city = $tree->{xml_api_reply}->{weather}->{forecast_information}->{city}->{"-data"};

unless (defined($city)) {
    print "The weather service is currently unavailable. \n";
    open (MYFILE, '>/home/swarmp/public_html/status/polyweather.xhtml');
    print MYFILE qq(<?xml version="1.0" encoding="utf-8"?>\n);
    print MYFILE qq(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">\n);
    print MYFILE qq(<html xmlns="http://www.w3.org/1999/xhtml">\n);
    print MYFILE qq(<head><title>Weather is Unavailable!</title></head>\n);
    print MYFILE qq(<body>\n);
    print MYFILE qq(<p>\n);
    print MYFILE qq(The weather service is currently unavailable from the data vendor.\n);
    print MYFILE qq(</p>\n);
    print MYFILE qq(</body>\n);
    print MYFILE qq(</html>\n);
    close MYFILE;
    exit(0);
}...

Leave a Comment