Download the page.
555195
def _download(self):
        """"""
        print("Downloading!")
        def parse(result):
            print("Got %r back from Yahoo." % (result,))
            values = result.strip().split(",")
            self._value = float(values[1])
        d = getPage(
            "http://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=c4l1&s=%s=X"
            % (self._name,))
        d.addCallback(parse)
        d.addErrback(log.err)
        return d
838736
def download_url(url, save_as, iter_size=_default_iter_size, enable_verbose=True):
    
    msg = Messenger()
    if enable_verbose:
        msg.on()
    else:
        msg.off()

    msg.show("Downloading %s from %s..." % (save_as, url))

    with open(save_as, "wb") as f:
        response = requests.get(url, stream=True)

        if not response.ok:
            print("http get error!")
            return

        start_time = time.clock()
        downloaded_size = 0
        for block in response.iter_content(iter_size):
            if not block:
                break
            f.write(block)
            elapse = datetime.timedelta(seconds=(time.clock() - start_time))
            downloaded_size += sys.getsizeof(block)
            msg.show("    Finished %s, elapse %s." % (
                string_SizeInBytes(downloaded_size), elapse
            ))

    msg.show("    Complete!")
943780
def get(self):
        """"""
        method_name = "_download_" + self.name
        method = getattr(self, method_name)
        return method()
789411
def download(self, url, path):
        """"""
        # original_url = url
#        print(url)
        qurl = QUrl(url)
        url = to_text_string(qurl.toEncoded(), encoding='utf-8')

        logger.debug(str((url, path)))
        if url in self._workers:
            while not self._workers[url].finished:
                return self._workers[url]

        worker = DownloadWorker(url, path)

        # Check download folder exists
        folder = os.path.dirname(os.path.abspath(path))
        if not os.path.isdir(folder):
            os.makedirs(folder)

        request = QNetworkRequest(qurl)
        self._head_requests[url] = request
        self._paths[url] = path
        self._workers[url] = worker
        self._manager.head(request)
        self._timer.start()

        return worker
367320
def download(self, path):
        """"""

        service_get_resp = requests.get(self.location, cookies={"session": self.session})
        payload = service_get_resp.json()

        download_get_resp = requests.get(payload["content"])
        with open(path, "wb") as config_file:
            config_file.write(download_get_resp.content)
166844
def download_to(dir = Dir.pwd, opts = { force_download: false })
      delete_files!(dir) if opts[:force_download]

      return if file_exist?(dir)

      image = Tools.get(uri)

      append_file_data(dir, image)
      append_file_ext(dir)
    rescue StandardError => error
      logger.error({
        msg: 'Failed to download page',
        page: self,
        uri: uri,
        error: error,
        error_msg: error.message,
        backtrace: error.backtrace
      }.to_s)
    end
715362
def __doDownloadPage(self, *args, **kwargs):
        
        logger.debug("download page: %r, %r", args, kwargs)

        return self.__clientDefer(downloadPage(*args, **kwargs))
277536
def download(self, path, file):
        """"""

        resp = self._sendRequest("GET", path)
        if resp.status_code == 200:
            with open(file, "wb") as f:
                f.write(resp.content)
        else:
            raise YaDiskException(resp.status_code, resp.content)
481679
def download(self, path=None, show_progress=True, resume=True,
                 auto_retry=True, proapi=False):
        """"""
        self.api.download(self, path, show_progress, resume, auto_retry,
                          proapi)
478207
def download(url, encoding='utf-8'):
    """"""
    import requests
    response = requests.get(url)
    response.encoding = encoding
    return response.text
934169
function download(url) {
  return request('GET', url).then(function (res) {
    var out = {
      url: url,
      body: res.body,
      statusCode: res.statusCode,
      headers: res.headers,
      dependencies: []
    };

    try {
      if (out.statusCode === 302) {
        out.dependencies = [out.headers.location];
      } else if (!out.headers['content-type']) {
        out.dependencies = [];
      } else if (out.headers['content-type'].indexOf('text/html') !== -1) {
        out.dependencies = htmldeps(out.body.toString());
      } else if (out.headers['content-type'].indexOf('text/css') !== -1) {
        out.dependencies = cssdeps(out.body.toString());
      } else {
        out.dependencies = [];
      }
    } catch (ex) {
      ex.message = 'Error parsing deps for "' + url + '": ' + ex.message;
      throw ex;
    }
    return out;
  });
}
146446
def download(self):
        """"""
        return self._client.download_object(
            self._instance, self._bucket, self.name)
110363
public function download()
    {
        $basedir = dirname($this->fileName);
        foreach ($this->data as $fetch) {
            $filename = $basedir . '/' . $fetch['filename'];
            if (! file_exists($filename)) {
                $this->_downloadFile($fetch['url'], $filename);
            }
        }
    }
811995
def download_url(url):
    ''''''
    import urllib2
    try:
        resp = urllib2.urlopen(url)
        headers = resp.info()
    except urllib2.URLError as e:
        print('Error downloading %s' % url)
        return None
    return resp.read()
951332
def _download(self, url, path=None, force=False):
        """"""
        if path is None:
            path = url.split('/')[-1]

        # Make dir if non existent
        folder = os.path.dirname(os.path.abspath(path))

        if not os.path.isdir(folder):
            os.makedirs(folder)

        # Start actual download
        try:
            r = requests.get(url, stream=True, proxies=self.proxy_servers)
        except Exception as error:
            print('ERROR', 'here', error)
            logger.error(str(error))
            # Break if error found!
#            self._sig_download_finished.emit(url, path)
#            return path

        total_size = int(r.headers.get('Content-Length', 0))

        # Check if file exists
        if os.path.isfile(path) and not force:
            file_size = os.path.getsize(path)

            # Check if existing file matches size of requested file
            if file_size == total_size:
                self._sig_download_finished.emit(url, path)
                return path

        # File not found or file size did not match. Download file.
        progress_size = 0
        with open(path, 'wb') as f:
            for chunk in r.iter_content(chunk_size=self._chunk_size):
                if chunk:
                    f.write(chunk)
                    progress_size += len(chunk)
                    self._sig_download_progress.emit(url, path,
                                                     progress_size,
                                                     total_size)
            self._sig_download_finished.emit(url, path)

        return path
1108388
def download(self, sub_url):
        """"""
        response = requests.get(sub_url, headers=self.headers).text
        soup = BS(response, 'lxml')
        downlink = self.base_url+soup.select('.download a')[0]['href']
        data = requests.get(downlink, headers=self.headers)
        z = zipfile.ZipFile(cStringIO.StringIO(data.content))
        srt_files = [f.filename for f in z.filelist
                     if f.filename.rsplit('.')[-1].lower() in ['srt', 'ass']]
        z.extract(srt_files[0], '/tmp/')
        return srt_files[0]
680260
public function getPage()
    {
        if (null === $this->site || null === $this->layout || null === $this->title) {
            $this->reset();
            throw new \Exception("Required data missing");
        }

        $page = new Page($this->uid);
        $page->setTitle($this->title);
        $page->setSite($this->site);

        if (null !== $this->parent) {
            $page->setParent($this->insureParentIsSection($this->parent));
        }

        $page->setLayout($this->layout, $this->itemToPushInMainZone);

        if (null !== $this->url) {
            $page->setUrl($this->url);
        }

        if (null !== $this->redirect) {
            $page->setRedirect($this->redirect);
        }

        if (null !== $this->target) {
            $page->setTarget($this->target);
        }

        if (null !== $this->altTitle) {
            $page->setAltTitle($this->altTitle);
        }

        if (null !== $this->state) {
            $page->setState($this->state);
        }

        if (null !== $this->publishedAt) {
            $page->setPublishing($this->publishedAt);
        }

        if (null !== $this->createdAt) {
            $page->setCreated($this->createdAt);
        }

        if (null !== $this->archiving) {
            $page->setArchiving($this->archiving);
        }

        $pageContentSet = $page->getContentSet();
        $this->updateContentRevision($pageContentSet);
        while ($column = $pageContentSet->next()) {
            $this->updateContentRevision($column);
        }

        if (0 < count($this->elements)) {
            foreach ($this->elements as $e) {
                $column = $pageContentSet->item($e['content_set_position']);
                if ($e['set_main_node']) {
                    $e['content']->setMainNode($page);
                }

                $column->push($e['content']);
            }

            $pageContentSet->rewind();
        }

        $this->doPersistIfValid($page);

        $this->reset();

        return $page;
    }