This will allow you to download datasets directly.
WARNING! You must remove these before publishing the project.
I prefer to use kagglehub, with a very simple script (referenced below).
import os
import json
with open("kaggle.json") as fp:
credentials = json.load(fp)
username = credentials['username']
key = credentials['key']
# alternatively, ask for key
# username = input("Enter your username: ")
# key = input("Enter your key: ")
# This sets the keys
os.environ['KAGGLE_USERNAME'] = username
os.environ['KAGGLE_KEY'] = key
from kaggle import api
api.dataset_download_files('yasserh/titanic-dataset', path='data', unzip=True)
