downloadkit/downloadkit.py
changeset 198 04b0678959bf
parent 197 32417d4f42da
child 199 90e6dc719131
equal deleted inserted replaced
197:32417d4f42da 198:04b0678959bf
    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.13'
    29 version = '0.14'
    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 = []
   403 		f.close()
   403 		f.close()
   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 (\(Public\) )?v(\d\.\d\.[0-9a-z]+)', doc, re.IGNORECASE)
   409 	if match and match.group(1) != version:
   409 	if match and match.group(2) != 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...