Switching from deleting caches to version checking the cache
[theonering] / src / gvoice / browser_emu.py
index 108fb5c..58ecd08 100644 (file)
@@ -94,7 +94,7 @@ class MozillaEmulator(object):
 
                @return: The raw HTML page data
                """
-               _moduleLogger.info("Performing download of %s" % url)
+               _moduleLogger.debug("Performing download of %s" % url)
 
                if extraheaders is None:
                        extraheaders = {}
@@ -115,13 +115,14 @@ class MozillaEmulator(object):
                                        return openerdirector
 
                                return self._read(openerdirector, trycount)
-                       except urllib2.URLError:
+                       except urllib2.URLError, e:
+                               _moduleLogger.debug("%s: %s" % (e, url))
                                cnt += 1
                                if (-1 < trycount) and (trycount < cnt):
                                        raise
 
                        # Retry :-)
-                       _moduleLogger.info("MozillaEmulator: urllib2.URLError, retryting %d" % cnt)
+                       _moduleLogger.debug("MozillaEmulator: urllib2.URLError, retrying %d" % cnt)
 
        def _build_opener(self, url, postdata = None, extraheaders = None, forbidRedirect = False):
                if extraheaders is None:
@@ -154,7 +155,7 @@ class MozillaEmulator(object):
                )
                u.addheaders = [(
                        'User-Agent',
-                       'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4'
+                       'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729)'
                )]
                if not postdata is None:
                        req.add_data(postdata)