Perform a chunked GET request to url with optional authentication
        This is specifically to download files.
491039
def rest_get_stream(self, url, auth=None, verify=True, cert=None):
        
        res = requests.get(url, auth=auth, stream=True, verify=verify, cert=cert)
        return res.raw, res.status_code
948121
def download_file(url, filename):
    """"""
    r = _get_requests_session().get(url, stream=True)
    if not r.ok:
        raise IOError("Unable to download file")

    with open(filename, "wb") as f:
        f.write(r.content)
149226
def get(self, url, data=None, params=None):
        
        return self.request("get", url, data, params)
241358
def download(url, path)
      if url.match(FILE_URL)
        FileUtils.cp(url.sub(FILE_URL, ''), path)
      else
        File.open(path, 'w+') do |file|
          Net::HTTP.get_response(URI(url)) do |response|
            response.read_body do |chunk|
              file.write chunk
            end
          end
        end
      end
      path
    end
304745
def hashed_download(url, temp, digest):
    """"""
    # Based on pip 1.4.1's URLOpener but with cert verification removed
    def opener():
        opener = build_opener(HTTPSHandler())
        # Strip out HTTPHandler to prevent MITM spoof:
        for handler in opener.handlers:
            if isinstance(handler, HTTPHandler):
                opener.handlers.remove(handler)
        return opener

    def read_chunks(response, chunk_size):
        while True:
            chunk = response.read(chunk_size)
            if not chunk:
                break
            yield chunk

    response = opener().open(url)
    path = join(temp, urlparse(url).path.split('/')[-1])
    actual_hash = sha256()
    with open(path, 'wb') as file:
        for chunk in read_chunks(response, 4096):
            file.write(chunk)
            actual_hash.update(chunk)

    actual_digest = actual_hash.hexdigest()
    if actual_digest != digest:
        raise HashError(url, path, actual_digest, digest)
    return path
864958
def download_chunk(self, url, headers):
        
        response = requests.get(url, headers=headers, stream=True)
        if response.status_code == SWIFT_EXPIRED_STATUS_CODE \
                or response.status_code == S3_EXPIRED_STATUS_CODE:
            raise DownloadInconsistentError(response.text)
        response.raise_for_status()
        self.actual_bytes_read = 0
        self._write_response_to_file(response)
        self._verify_download_complete()
171947
def downloadFile(url,outfile=None): 
    '''  '''
    if not outfile:
        outfile = url.split('/')[-1]
    r = requests.get(url, stream=True)
    with open(outfile, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024): 
            if chunk: 
                f.write(chunk)
    return outfile
415975
private HttpURLConnection obtainConnection(URL url) throws DownloadFailedException {
        HttpURLConnection conn = null;
        try {
            LOGGER.debug("Attempting retrieval of {}", url.toString());
            conn = connFactory.createHttpURLConnection(url, this.usesProxy);
            conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
            conn.connect();
            int status = conn.getResponseCode();
            int redirectCount = 0;
            // TODO - should this get replaced by using the conn.setInstanceFollowRedirects(true);
            while ((status == HttpURLConnection.HTTP_MOVED_TEMP
                    || status == HttpURLConnection.HTTP_MOVED_PERM
                    || status == HttpURLConnection.HTTP_SEE_OTHER)
                    && MAX_REDIRECT_ATTEMPTS > redirectCount++) {
                final String location = conn.getHeaderField("Location");
                try {
                    conn.disconnect();
                } finally {
                    conn = null;
                }
                LOGGER.debug("Download is being redirected from {} to {}", url.toString(), location);
                conn = connFactory.createHttpURLConnection(new URL(location), this.usesProxy);
                conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
                conn.connect();
                status = conn.getResponseCode();
            }
            if (status != 200) {
                try {
                    conn.disconnect();
                } finally {
                    conn = null;
                }
                final String msg = format("Error retrieving %s; received response code %s.", url.toString(), status);
                LOGGER.error(msg);
                throw new DownloadFailedException(msg);
            }
        } catch (IOException ex) {
            try {
                if (conn != null) {
                    conn.disconnect();
                }
            } finally {
                conn = null;
            }
            if ("Connection reset".equalsIgnoreCase(ex.getMessage())) {
                final String msg = format("TLS Connection Reset%nPlease see "
                        + "http://jeremylong.github.io/DependencyCheck/data/tlsfailure.html "
                        + "for more information regarding how to resolve the issue.");
                LOGGER.error(msg);
                throw new DownloadFailedException(msg, ex);
            }
            final String msg = format("Error downloading file %s; unable to connect.", url.toString());
            throw new DownloadFailedException(msg, ex);
        }
        return conn;
    }
205456
def http_get(url, filename=None):
    """"""
    try:
        ret = requests.get(url)
    except requests.exceptions.SSLError as error:
        _LOGGER.error(error)
        return False

    if ret.status_code != 200:
        return False

    if filename is None:
        return ret.content

    with open(filename, 'wb') as data:
        data.write(ret.content)
    return True
390182
def download_url(url, back_off=True, **kwargs):
    
    if back_off:
        return _download_with_backoff(url, as_file=True, **kwargs)
    else:
        return _download_without_backoff(url, as_file=True, **kwargs)
326145
def download(url, path=None, headers=None, session=None, show_progress=True,
             resume=True, auto_retry=True, max_rst_retries=5,
             pass_through_opts=None, cainfo=None, user_agent=None, auth=None):
    """"""
    hm = Homura(url, path, headers, session, show_progress, resume,
                auto_retry, max_rst_retries, pass_through_opts, cainfo,
                user_agent, auth)
    hm.start()
1144933
def stream(self, url, params=None, chunk_size=64*1024):
        ''
        r = self.request(url, params=params)
        for chunk in r.iter_content(chunk_size):
            yield chunk
1047725
def download_file(self, url, local_path):
        
        response = requests.get(url, stream=True)

        with open(local_path, 'wb') as f:
            for chunk in tqdm(response.iter_content(chunk_size=1024), unit='KB'):
                if chunk: # filter out keep-alive new chunks
                    f.write(chunk)
                    f.flush()
536526
function wget(fileURL, callback) {
		var
			chunks = [],
			isHTTPS = fileURL.indexOf('https') === 0,
			client = isHTTPS ? https : http,
			options = fileURL
		;
		if (isHTTPS) {
			options = url.parse(fileURL);
			options.rejectUnauthorized = false;
			options.agent = new https.Agent(options);
		}
		client.get(options, function (res) {
			res.on('data', function (chunk) {
				chunks.push(chunk);
			}).on('end', function () {
				callback(null, joinBuffers(chunks));
			});
		});
	}
364478
def download_file(url, path, session=None, params=None):
    

    if url[0:2] == '//':
        url = 'https://' + url[2:]

    # Use a temporary file so that we don't import incomplete files.
    tmp_path = path + '.tmp'

    if session and params:
        r = session.get( url, params=params, stream=True )
    elif session and not params:
        r = session.get( url, stream=True )
    else:
        r = requests.get(url, stream=True)
    with open(tmp_path, 'wb') as f:
        total_length = int(r.headers.get('content-length', 0))
        for chunk in progress.bar(r.iter_content(chunk_size=1024), expected_size=(total_length / 1024) + 1):
            if chunk:  # filter out keep-alive new chunks
                f.write(chunk)
                f.flush()

    os.rename(tmp_path, path)

    return path
689417
def http_get(url, fout=None):
    """"""
    print('requests.get({URL}, stream=True)'.format(URL=url))
    rsp = requests.get(url, stream=True)
    if rsp.status_code == 200 and fout is not None:
        with open(fout, 'wb') as prt:
            for chunk in rsp:  # .iter_content(chunk_size=128):
                prt.write(chunk)
            print('  WROTE: {F}\n'.format(F=fout))
    else:
        print(rsp.status_code, rsp.reason, url)
        print(rsp.content)
    return rsp
440150
def downloadFileFromUrl(self, url):
		""""""
		fullurl = self.baseUrl + url
		try:
			urlobj = urllib2.urlopen(fullurl)
			contents = urlobj.read()
		except urllib2.HTTPError, e:
			self.printd("HTTP error:", e.code, url)
			return None
		except urllib2.URLError, e:
			self.printd("URL error:", e.code, url)
			return None
		self.printd("Fetched '%s' (size %d bytes)" % (fullurl, len(contents)))
		return contents