- cmdline = "%s " \
- "--connect-timeout %d " \
- "--max-time %d " \
- "--header Pragma: " \
- "--output %s " \
- "--fail " % \
- (self.CURL_CMD, ConnectTimeout,
- MaxTransferTime, DestFilePath)
-
- if dopostdata:
- cmdline = cmdline + "--data '" + postdata + "' "
-
- if FormData:
- cmdline = cmdline + "".join(["--form '" + field + "' " for field in FormData])
-
- if not self.VERBOSE:
- cmdline = cmdline + "--silent "
-
- if self.USE_PROXY:
- cmdline = cmdline + "--proxy %s " % self.PROXY
-
- if DoSSL:
- cmdline = cmdline + "--sslv%d " % self.CURL_SSL_VERSION
- if DoCertCheck:
- cmdline = cmdline + "--cacert %s " % certpath
-
- cmdline = cmdline + url
-
- self.Message( "curl command: %s" % cmdline )
-
-
- if PYCURL_LOADED:
- try:
- # setup the output file
- outfile = open(DestFilePath,"wb")
-
- self.Message( "Opened output file %s" % DestFilePath )
+ try:
+ # setup the output file
+ with open(DestFilePath,"wb") as outfile: