Reputation: 2458
My question is a continuation of: documentation for Kaggle API *within* python?.
So, I download a dataset with the Kaggle API:
api.dataset_download_files('berkeleyearth/climate-change-earth-surface-temperature-data',
path='datasets/kaggle', unzip=True)
Is there a way to fetch the name of the downloaded csv files? Or do I have to make sure I download (and unzip) the files in a dedicated folder that I should then browse?
Upvotes: 2
Views: 2762
Reputation: 26333
pip install kaggle
then authenticate
Authenticating With API Server
from kaggle.api.kaggle_api_extended import KaggleApi
api = KaggleApi()
api.authenticate()
Downloading Datasets
and download
# Download all files of a dataset
# Signature: dataset_download_files(dataset, path=None, force=False, quiet=True, unzip=False)
api.dataset_download_files('avenn98/world-of-warcraft-demographics')
# downoad single file
#Signature: dataset_download_file(dataset, file_name, path=None, force=False, quiet=True)
api.dataset_download_file('avenn98/world-of-warcraft-demographics','WoW Demographics.csv')
Upvotes: 0
Reputation: 1377
See the documentation here: https://technowhisp.com/kaggle-api-python-documentation/
5.2 Listing dataset files
api.dataset_list_files('avenn98/world-of-warcraft-demographics').files
Upvotes: 1