Kaggle网站发布方法返回状态码400

时间:2018-09-18 15:18:30

标签: python-3.x jupyter-notebook

在执行此代码块时,我无法以post方法的方式从Kaggle网站获取数据。它以status_code 400结尾:

#imports
import requests
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': os.environ.get("KAGGLE_PASSWORD")
}

print(payload)

#url for train file
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.text)

0 个答案:

没有答案