#NEWLINE# def download( self ) : #NEWLINE# #INDENT# self . _printStartDownloadMessage ( ) #NEWLINE# response = requests . get ( chunk . url , stream = True ) #NEWLINE# response . raise_for_status ( ) #NEWLINE# try : #NEWLINE# #INDENT# contentLength = int ( response . headers [ 'content-length' ] ) #NEWLINE# self . fileSize = contentLength #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# with open ( self . path , 'wb' ) as outputFile : #NEWLINE# #INDENT# for chunk in response . iter_content ( chunk_size = self . chunkSize ) : #NEWLINE# #INDENT# self . bytesReceived += self . chunkSize #NEWLINE# self . _updateDisplay ( ) #NEWLINE# outputFile . write ( chunk ) #NEWLINE# #UNINDENT# #UNINDENT# self . _cleanUp ( )