<jupyter_start><jupyter_text>Extracting Titanic Disaster Data From Kaggle<jupyter_code>import sys
!{sys.executable} -m pip install python-dotenv
from dotenv import load_dotenv, find_dotenv
# find .env automatically by valking up directories until it's found
dotenv_path = find_dotenv()
# load up the entries as environmeent variables
load_dotenv(dotenv_path)
# extracting environment variables using os.environ.get
import os
KAGGLE_PASSWORD = os.environ.get("<PASSWORD>")
KAGGLE_USERNAME = os.environ.get("KAGGLE_USERNAME")
print(KAGGLE_PASSWORD, KAGGLE_USERNAME)
# imports
import requests
from requests import session
import os
from dotenv import load_dotenv, find_dotenv
# payload for post
payload = {
    'action':'login',
    'username': os.environ.get("KAGGLE_USERNAME"),
    'password': <PASSWORD>("<PASSWORD>")
}

# url for train file (get the link from kaggle website)
url = 'https://www.kaggle.com/c/titanic/download/train.csv'

# setup session
with session() as c:
    # post request
    c.post('https://www.kaggle.com/account/login', data=payload)
    # get request
    response = c.get(url)
    # print response text
    print(response)<jupyter_output><Response [200]>
StarcoderdataJupyterStructuredCleanDedup