def download(self):
        """
        Request url and return his content
        The Requested content will be cached into the default temp directory.
        """
        if os.path.isfile(self.archive_path):
            print("Use %r" % self.archive_path)
            with open(self.archive_path, "rb") as f:
                content = f.read()
        else:
            print("Request: %r..." % self.URL)
            # Warning: HTTPS requests do not do any verification of the server's certificate.
            f = urlopen(self.URL)
            content = f.read()
            with open(self.archive_path, "wb") as out_file:
                out_file.write(content)

        # Check SHA hash:
        current_sha1 = hashlib.sha1(content).hexdigest()
        assert current_sha1 == self.DOWNLOAD_SHA1, "Download sha1 value is wrong! SHA1 is: %r" % current_sha1
        print("Download SHA1: %r, ok." % current_sha1)
def download ( self ) : if os . path . isfile ( self . archive_path ) : print ( "Use %r" % self . archive_path ) with open ( self . archive_path , "rb" ) as f : content = f . read ( ) else : print ( "Request: %r..." % self . URL ) f = urlopen ( self . URL ) content = f . read ( ) with open ( self . archive_path , "wb" ) as out_file : out_file . write ( content ) current_sha1 = hashlib . sha1 ( content ) . hexdigest ( ) assert current_sha1 == self . DOWNLOAD_SHA1 , "Download sha1 value is wrong! SHA1 is: %r" % current_sha1 print ( "Download SHA1: %r, ok." % current_sha1 )
Request url and return his content
        The Requested content will be cached into the default temp directory.