<reponame>talosiot-will/agora
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/extract.ipynb (unless otherwise specified).

__all__ = ['kcred', 'unzip', 'download_kaggle_dataset']

# Cell
import os
kcred = {"username":"williamgathright","key":"1d72fbd5e033043ace0a49d825f9f838"}
os.environ["KAGGLE_USERNAME"] = kcred['username']
os.environ["KAGGLE_KEY"]  = kcred['key']
from kaggle import api

# Cell
import zipfile
def unzip(zipped, targetdir=HERE):
    with zipfile.ZipFile(zipped,"r") as zip_ref:
        zip_ref.extractall(targetdir)

def download_kaggle_dataset(ds_name):
    '''
    ds_name: str
        Name of the kaggle dataset
    '''
    api.competition_download_cli(ds_name)
    unzip(ds_name+'.zip', targetdir=ds_name)