Download data for a given Kaggle competition.
333154
def download_kaggle_data(self, competition_name):
    """"""
    with self._downloader.tqdm():
      kaggle_downloader = self._downloader.kaggle_downloader(competition_name)
      urls = kaggle_downloader.competition_urls
      files = kaggle_downloader.competition_files
      return _map_promise(self._download,
                          dict((f, u) for (f, u) in zip(files, urls)))
478207
def download(url, encoding='utf-8'):
    """"""
    import requests
    response = requests.get(url)
    response.encoding = encoding
    return response.text
29247
def download_data():
    """"""

    n_datasets = 2
    for d in range(1, n_datasets + 1):
        if not os.path.isdir('enron%d' % d):

            URL = url[d-1]
            print("Downloading %d/%d: %s" % (d, n_datasets, URL))
            folderzip = 'enron%d.zip' % d

            with urlopen(URL) as remotedata:
                with open(folderzip, 'wb') as z:
                    z.write(remotedata.read())

            with ZipFile(folderzip) as z:
                z.extractall()
            os.remove(folderzip)
305904
def fetch(self):
        """"""
        self.content = self.client.get_content(
            uri=self.uri
        )
        self.hash = hashlib.sha256(
            self.content
        ).hexdigest()
204216
def run(self):
        """"""
        try:
            answer = urlopen(self.url + "&mode=queue").read().decode()
        except (HTTPError, URLError) as error:
            self.output = {
                "full_text": str(error.reason),
                "color": "#FF0000"
            }
            return

        answer = json.loads(answer)

        # if answer["status"] exists and is False, an error occured
        if not answer.get("status", True):
            self.output = {
                "full_text": answer["error"],
                "color": "#FF0000"
            }
            return

        queue = answer["queue"]
        self.status = queue["status"]

        if self.is_paused():
            color = self.color_paused
        elif self.is_downloading():
            color = self.color_downloading
        else:
            color = self.color

        if self.is_downloading():
            full_text = self.format.format(**queue)
        else:
            full_text = self.format_paused.format(**queue)

        self.output = {
            "full_text": full_text,
            "color": color
        }
217173
def download_data():
    
    with urlopen(_retrieve_download_url()) as f:
        with open(os.path.join(CACHE_FOLDER, CACHE_ZIP), "wb") as local_file:
            local_file.write(f.read())
246941
function downloadPersonalData(callback) {
    async.waterfall([
        function (callback) {
            request.post({
                url: 'http://kazina.com/dummy/dummy.cgi',
                encoding: "binary",
                form: {
                    "format": "html",
                    "count": "500",
                    "name": "1",
                    "name_style": "f g",
                    "r": "1",
                    "ml": "1",
                    "sex": "1",
                    "sex_format": ['male', 'female'].join('|'),
                    "age": "1",
                    "age_min": "12",
                    "age_max": "80",
                    "bd": "on",
                    "city": "1",
                    "phone": "1",
                    "k": "1"
                }
            }, callback)
        },
        function (res, html, callback) {
            var converted = new Iconv('shift-jis', 'UTF-8//TRANSLIT//IGNORE')
                .convert(new Buffer(html, 'binary')).toString();
            var $ = cheerio.load(converted);
            callback(null, $);
        },
        function ($, callback) {
            var table = $('table[width="100%"]'),
                data = table.find('tr').toArray()
                    .filter(function (tr, i) {
                        return i > 0;
                    })
                    .map(function (tr, i) {
                        return $(tr).find('td').toArray().map(function (td) {
                            return $(td).text();
                        });
                    })
                    .map(function (data) {
                        return {
                            familyName: data[1].split(' ').shift(),
                            firstName: data[1].split(' ').pop(),
                            familyNameKana: data[2].split(' ').shift(),
                            firstNameKana: data[2].split(' ').pop(),
                            email: data[3],
                            gender: {male: '男', female: '女'}[data[4]],
                            age: data[5],
                            birthday: data[6]
                        }
                    });
            callback(null, data);
        }
    ], callback);
}
1162562
function download(url, callback) {
	let reqData = URL.parse(url);
	reqData.servername = reqData.hostname;
	reqData.headers = {"User-Agent": "node-steam-user data parser"};
	reqData.method = "GET";

	// This will crash if there's an error. But that's fine.
	HTTPS.request(reqData, function(res) {
		let data = "";
		res.on('data', function(chunk) {
			data += chunk;
		});

		res.on('end', function() {
			callback(data);
		});
	}).end();
}
744885
def main(items=None, printmd=None, printcal=False, found=False,
         save=None, download=None, requestor_pays=False, **kwargs):
    
    
    if items is None:
        ## if there are no items then perform a search
        search = Search.search(**kwargs)
        if found:
            num = search.found()
            print('%s items found' % num)
            return num
        items = search.items()
    else:
        # otherwise, load a search from a file
        items = Items.load(items)

    print('%s items found' % len(items))

    # print metadata
    if printmd is not None:
        print(items.summary(printmd))

    # print calendar
    if printcal:
        print(items.calendar())

    # save all metadata in JSON file
    if save is not None:
        items.save(filename=save)

    # download files given `download` keys
    if download is not None:
        if 'ALL' in download:
            # get complete set of assets
            download = set([k for i in items for k in i.assets])
        for key in download:
            items.download(key=key, path=config.DATADIR, filename=config.FILENAME, requestor_pays=requestor_pays)

    return items
45737
def download(self):
        
        self.housekeeping()
        self.rippled_history()
        if self.resampling_frequencies is not None:
            self.find_markets()
            self.resample_time_series()
1258985
def download(data_dir):
  """"""
  tf.gfile.MakeDirs(data_dir)

  training_file_path = os.path.join(data_dir, TRAINING_FILE)
  if not tf.gfile.Exists(training_file_path):
    _download_and_clean_file(training_file_path, TRAINING_URL)

  eval_file_path = os.path.join(data_dir, EVAL_FILE)
  if not tf.gfile.Exists(eval_file_path):
    _download_and_clean_file(eval_file_path, EVAL_URL)
636428
def download(csvpath, asset_manager_id, data_id_type, data_id_list):
        """"""
        interface = interface_direct_csvpath(csvpath)
        logging.config.dictConfig(DEFAULT_LOGGING)
        logger = logging.getLogger(__name__)
        objs = []
        for data_id in data_id_list:
            Dict = dict()
            Dict[data_id_type] = data_id
            objs.append(interface.retrieve(asset_manager_id=asset_manager_id, **Dict))
        return objs
943780
def get(self):
        """"""
        method_name = "_download_" + self.name
        method = getattr(self, method_name)
        return method()
978497
def _download(self):
        """"""
        # reproject GSSHA grid and get bounds
        min_x, max_x, min_y, max_y = self.gssha_grid.bounds(as_geographic=True)
        if self.era_download_data == 'era5':
            log.info("Downloading ERA5 data ...")
            download_era5_for_gssha(self.lsm_input_folder_path,
                                    self.download_start_datetime,
                                    self.download_end_datetime,
                                    leftlon=min_x-0.5,
                                    rightlon=max_x+0.5,
                                    toplat=max_y+0.5,
                                    bottomlat=min_y-0.5)
        else:
            log.info("Downloading ERA Interim data ...")
            download_interim_for_gssha(self.lsm_input_folder_path,
                                       self.download_start_datetime,
                                       self.download_end_datetime,
                                       leftlon=min_x-1,
                                       rightlon=max_x+1,
                                       toplat=max_y+1,
                                       bottomlat=min_y-1)
583669
def competition_leaderboard_download(self, competition, path, quiet=True):
        
        response = self.process_response(
            self.competition_download_leaderboard_with_http_info(
                competition, _preload_content=False))

        if path is None:
            effective_path = self.get_default_download_dir(
                'competitions', competition)
        else:
            effective_path = path

        file_name = competition + '.zip'
        outfile = os.path.join(effective_path, file_name)
        self.download_file(response, outfile, quiet)
391830
def maybe_download(url, filename):
  """"""
  if not os.path.exists(WORK_DIRECTORY):
    os.mkdir(WORK_DIRECTORY)
  filepath = os.path.join(WORK_DIRECTORY, filename)
  if not os.path.exists(filepath):
    filepath, _ = request.urlretrieve(url + filename, filepath)
    statinfo = os.stat(filepath)
    print('Successfully downloaded', filename, statinfo.st_size, 'bytes.')
  return filepath
972217
def download_file(self, *args, **kwargs):
        """"""
        return download_file(*args, **self._merge_overrides(**kwargs)).run()