Mark all requests with the "downloadkit.py script" User Agent string, so that we can spot them in the HTTP logs
authorWilliam Roberts <williamr@symbian.org>
Tue, 22 Dec 2009 12:34:01 +0000
changeset 126 c107e11c37e8
parent 125 b60a149520e7
child 127 e6bf005a5f58
Mark all requests with the "downloadkit.py script" User Agent string, so that we can spot them in the HTTP logs
downloadkit/downloadkit.py
--- a/downloadkit/downloadkit.py	Fri Dec 18 13:32:54 2009 +0000
+++ b/downloadkit/downloadkit.py	Tue Dec 22 12:34:01 2009 +0000
@@ -113,6 +113,7 @@
 		self.status = self.unzip(self.filename, self.levels, self.deletelevels)
 
 def downloadkit(version):
+	headers = { 'User-Agent' : user_agent }
 	urlbase = 'http://developer.symbian.org/main/tools_and_kits/downloads/'
 
 	viewid = 5   # default to Symbian^3
@@ -122,7 +123,7 @@
 		viewid= 5  # Symbian^3
 	url = urlbase + ('view.php?id=%d'% viewid) + 'vId=' + version
 
-	req = urllib2.Request(url)
+	req = urllib2.Request(url, None, headers)
 	response = urllib2.urlopen(req)
 	doc=response.read()
 	
@@ -143,7 +144,7 @@
 		downloadurl = urlbase + result['href']
 		filename = result['title']
 		print 'Downloading ' + filename
-		req = urllib2.Request(downloadurl)
+		req = urllib2.Request(downloadurl, None, headers)
 		
 		try:
 			response = urllib2.urlopen(req)