Downloads the user's desired data.
 @return [Hash]
334163
def download_data
      scraper_data = {}

      @data_to_get.each do |data_category|
        if /liked_(.*)/ =~ data_category
          argument = $1.to_sym  # :tracks, :artists, :stations or :albums
          scraper_data[data_category] = @scraper.public_send(:likes, argument)
        else
          scraper_data[data_category] = @scraper.public_send(data_category)
        end
      end

      scraper_data
    end
1348904
def download_users(id)
      doc = permissions_doc(id)
      return [] if doc.nil?
      users = Array(doc[self.class.read_user_field]) + Array(doc[self.class.edit_user_field])
      Rails.logger.debug("[CANCAN] download_users: #{users.inspect}")
      users
    end
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
1281575
def download(self, file_to_be_downloaded, perform_download=True, download_to_path=None):
        
        response = self.get(
            '/path/data/', file_to_be_downloaded, raw=False)
        if not perform_download:
            # The caller can decide how to process the download of the data
            return response
        if not download_to_path:
            download_to_path = file_to_be_downloaded.split("/")[-1]
        # download uses shutil.copyfileobj to download, which copies
        # the data in chunks
        o = open(download_to_path, 'wb')
        return shutil.copyfileobj(response.raw, o)
485719
def extract_download_options(options)
        url = options.fetch('url')

        # This avoids the potential for a KeyError
        headers = options.fetch('headers', {}) || {}

        file_size_value = options.fetch('file_size', 0)
        file_size = file_size_value.to_i

        output = {
          url: ::Addressable::URI.parse(url),
          headers: headers,
          file_size: file_size
        }

        output[:file_size] = get_file_size(output) if output[:file_size] < 1
        output
      end
943271
def download(path)
      resp, body = content_request('/files/download', path: path)
      return FileMetadata.new(resp), body
    end
480578
def download!
      return download if file.nil?

      file.close
      file.unlink
      self.file = nil
      download
    end
1272582
def save!
      response = HTTParty.put("#{users_base_path}/#{id}", timeout: timeout, headers: headers, body: to_json)
      get_body_from(response)
    end
1355708
def download(self):
        
        p = Pool()
        p.map(self._download, self.days)
946407
def download_input
      return unless input_is_url?
      Dir.chdir(@work_directory) do
        @input_path = File.join(@work_directory, safe_filename(@input))
        @file_name = File.basename(@input_path, File.extname(@input_path))
        download(@input, @input_path)
      end
    end
1186563
def download(self, uri, file_path):
        
        with open(file_path, 'wb') as file:
            return self._connection.download_to_stream(file, uri)
1003563
def download
      @uploaded_file = UploadedFile.where(title: params[:title]).first
      unless @uploaded_file
        raise ActiveRecord::RecordNotFound, "Could not find file '#{params[:title]}'"
      end
      redirect_to @uploaded_file.file_url
    end
854916
public function download()
    {
        // define output
        $output = $this->getOutput();

        foreach ($this->getHeaders(false) as $header) {
            header($header);
        }

        // echo the output and it will be a download
        echo $output;
    }
488049
def download(url, filename)
      File.open(filename, "w") do |file|
        file.puts(make_request(:get, url, headers: {'content-type' => 'application/atom+xml'}).body)
      end
    end
1002736
def get(path,data={},headers=nil)
      data_to_query(data)
      if headers == nil
        response = @http.send_request('GET', path, @defaults[:data])
      else
        response = @http.send_request('GET', path, @defaults[:data], headers)
      end
      response
    end
146788
def get
      uri = self.url
      http = Net::HTTP.new(uri.host, uri.port)

      if @ssl
        http.use_ssl = true
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
      end

      request = Net::HTTP::Get.new(uri.request_uri)

      if @auth
        request.basic_auth(@username, @password)
      end

      request["User-Agent"] = "Monit Ruby client #{Monit::VERSION}"

      begin
        response = http.request(request)
      rescue Errno::ECONNREFUSED
        return false
      end

      if (response.code =~ /\A2\d\d\z/)
        @xml = response.body
        return self.parse(@xml)
      else
        return false
      end
    end
289334
def download(self):
        
        # Prepare output path
        self.output_file = QFile(self.output_path)
        if not self.output_file.open(QFile.WriteOnly):
            raise IOError(self.output_file.errorString())

        # Prepare downloaded buffer
        self.downloaded_file_buffer = QByteArray()

        # Request the url
        request = QNetworkRequest(self.url)
        self.reply = self.manager.get(request)
        self.reply.readyRead.connect(self.get_buffer)
        self.reply.finished.connect(self.write_data)
        self.manager.requestTimedOut.connect(self.request_timeout)

        if self.progress_dialog:
            # progress bar
            def progress_event(received, total):
                """Update progress.

                :param received: Data received so far.
                :type received: int

                :param total: Total expected data.
                :type total: int
                """
                # noinspection PyArgumentList
                QgsApplication.processEvents()

                self.progress_dialog.adjustSize()

                human_received = humanize_file_size(received)
                human_total = humanize_file_size(total)

                label_text = tr("%s : %s of %s" % (
                    self.prefix_text, human_received, human_total))

                self.progress_dialog.setLabelText(label_text)
                self.progress_dialog.setMaximum(total)
                self.progress_dialog.setValue(received)

            # cancel
            def cancel_action():
                """Cancel download."""
                self.reply.abort()
                self.reply.deleteLater()

            self.reply.downloadProgress.connect(progress_event)
            self.progress_dialog.canceled.connect(cancel_action)

        # Wait until finished
        # On Windows 32bit AND QGIS 2.2, self.reply.isFinished() always
        # returns False even after finished slot is called. So, that's why we
        # are adding self.finished_flag (see #864)
        while not self.reply.isFinished() and not self.finished_flag:
            # noinspection PyArgumentList
            QgsApplication.processEvents()

        result = self.reply.error()
        try:
            http_code = int(self.reply.attribute(
                QNetworkRequest.HttpStatusCodeAttribute))
        except TypeError:
            # If the user cancels the request, the HTTP response will be None.
            http_code = None

        self.reply.abort()
        self.reply.deleteLater()

        if result == QNetworkReply.NoError:
            return True, None

        elif result == QNetworkReply.UnknownNetworkError:
            return False, tr(
                'The network is unreachable. Please check your internet '
                'connection.')

        elif http_code == 408:
            msg = tr(
                'Sorry, the server aborted your request. '
                'Please try a smaller area.')
            LOGGER.debug(msg)
            return False, msg

        elif http_code == 509:
            msg = tr(
                'Sorry, the server is currently busy with another request. '
                'Please try again in a few minutes.')
            LOGGER.debug(msg)
            return False, msg

        elif result == QNetworkReply.ProtocolUnknownError or \
                result == QNetworkReply.HostNotFoundError:
            # See http://doc.qt.io/qt-5/qurl-obsolete.html#encodedHost
            encoded_host = self.url.toAce(self.url.host())
            LOGGER.exception('Host not found : %s' % encoded_host)
            return False, tr(
                'Sorry, the server is unreachable. Please try again later.')

        elif result == QNetworkReply.ContentNotFoundError:
            LOGGER.exception('Path not found : %s' % self.url.path())
            return False, tr('Sorry, the layer was not found on the server.')

        else:
            return result, self.reply.errorString()