report Mozilla-compatible User-Agent

This commit is contained in:
Samson Melamed 2009-01-18 00:58:06 -05:00
parent 11696f949e
commit 14af7bc5a2

View file

@ -687,7 +687,8 @@ An error was ecountered while opening %s
return
def _retrieveURL(self, url, ext):
filecontents = urllib2.urlopen(url).read()
req = urllib2.Request(url, None, {'User-Agent': 'Mozilla/5.0 (compatible; Anki/%s)' % ankiqt.appVersion })
filecontents = urllib2.urlopen(req).read()
(fd, name) = tempfile.mkstemp(prefix="anki", suffix=".%s" % ext.encode("ascii"))
file = os.fdopen(fd, "wb")
file.write(filecontents)