version 0.18 - detect the login redirections on the new-look developer site PDK_3.0.0
authorWilliam Roberts <williamr@symbian.org>
Wed, 30 Jun 2010 16:19:02 +0100
changeset 302 c1b745b16f58
parent 301 1b8ed3598305
child 303 988ad79e9989
child 305 247cb9582bd0
version 0.18 - detect the login redirections on the new-look developer site Added additional debug information for incomplete transfers and login failures.
downloadkit/downloadkit.py
--- a/downloadkit/downloadkit.py	Tue Jun 29 21:56:25 2010 +0100
+++ b/downloadkit/downloadkit.py	Wed Jun 30 16:19:02 2010 +0100
@@ -26,7 +26,7 @@
 import hashlib
 import xml.etree.ElementTree as ET 
 
-version = '0.17'
+version = '0.18'
 user_agent = 'downloadkit.py script v' + version
 headers = { 'User-Agent' : user_agent }
 top_level_url = "https://developer.symbian.org"
@@ -312,13 +312,15 @@
 	try:
 		response = urllib2.urlopen(req)
 		chunk = response.read(CHUNK)
-		if chunk.find('<div id="sign_in_box">') != -1:
+		if chunk.find('<div class="signin">') != -1:
 			# our urllib2 cookies have gone awol - login again
+			if options.debug:
+				print "Redirected to login page? login again.."
 			login(False)
 			req = urllib2.Request(url, None, request_headers)
 			response = urllib2.urlopen(req)
 			chunk = response.read(CHUNK)
-			if chunk.find('<div id="sign_in_box">') != -1:
+			if chunk.find('<div class="signin">') != -1:
 				# still broken - give up on this one
 				print "*** ERROR trying to download %s" % (filename)
 				return False
@@ -407,6 +409,8 @@
 
 	if filesize > 0 and size != filesize:
 		print "Incomplete transfer - only received %d bytes of the expected %d byte file" % (size, filesize)
+		if options.debug:
+			print "Transfer delivered %d bytes in %s seconds" % (size-resume_start, now-start_time)
 		return False
 	
 	if options.progress: