downloadkit/downloadkit.py
changeset 197 32417d4f42da
parent 194 f74ba2451a44
child 198 04b0678959bf
equal deleted inserted replaced
196:0bb41dbeb81e 197:32417d4f42da
    24 from BeautifulSoup import BeautifulSoup
    24 from BeautifulSoup import BeautifulSoup
    25 from optparse import OptionParser
    25 from optparse import OptionParser
    26 import hashlib
    26 import hashlib
    27 import xml.etree.ElementTree as ET 
    27 import xml.etree.ElementTree as ET 
    28 
    28 
    29 version = '0.12'
    29 version = '0.13'
    30 user_agent = 'downloadkit.py script v' + version
    30 user_agent = 'downloadkit.py script v' + version
    31 headers = { 'User-Agent' : user_agent }
    31 headers = { 'User-Agent' : user_agent }
    32 top_level_url = "https://developer.symbian.org"
    32 top_level_url = "https://developer.symbian.org"
    33 passman = urllib2.HTTPPasswordMgrWithDefaultRealm()	# not relevant for live Symbian website
    33 passman = urllib2.HTTPPasswordMgrWithDefaultRealm()	# not relevant for live Symbian website
    34 download_list = []
    34 download_list = []
   404 
   404 
   405 	soup=BeautifulSoup(doc)
   405 	soup=BeautifulSoup(doc)
   406 
   406 
   407 	# check that this is the right version
   407 	# check that this is the right version
   408 	match = re.search('Platform Release v(\d\.\d\.[0-9a-z]+)', doc, re.IGNORECASE)
   408 	match = re.search('Platform Release v(\d\.\d\.[0-9a-z]+)', doc, re.IGNORECASE)
   409 	if match.group(1) != version:
   409 	if match and match.group(1) != version:
   410 		print "*** ERROR: version %s is not available" % version
   410 		print "*** ERROR: version %s is not available" % version
   411 		print "*** the website is offering version %s instead" % match.group(1)
   411 		print "*** the website is offering version %s instead" % match.group(1)
   412 		return 0
   412 		return 0
   413 		
   413 		
   414 	# let's hope the HTML format never changes...
   414 	# let's hope the HTML format never changes...