Commit 29ed78ac authored by Mark Daoust's avatar Mark Daoust
Browse files

Better upload error handling.

parent 0b478136
......@@ -144,9 +144,22 @@
"cell_type": "markdown",
"source": [
"# Get all the files \n",
"Since this tutorial will be using a dataset from Kaggle, it requires [creating an API Token](https://github.com/Kaggle/kaggle-api) for your Kaggle acccount, and uploading it. "
"Since this tutorial will be using a dataset from Kaggle, it requires [creating an API Token](https://github.com/Kaggle/kaggle-api#api-credentials) for your Kaggle acccount, and uploading it. "
]
},
{
"metadata": {
"id": "7jgdraTAiti0",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
"rm /content/.kaggle/kaggle.json\n"
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "sAVM1ZTmdAMR",
......@@ -173,7 +186,11 @@
" raise no_file\n",
" \n",
" uploaded = files.upload()\n",
" with open(token_file, \"w\") as f:\n",
" \n",
" if \"kaggle.json\" not in uploaded:\n",
" raise ValueError(\"You need an API key! see: \"\n",
" \"https://github.com/Kaggle/kaggle-api#api-credentials\")\n",
" with open(token_file, \"wb\") as f:\n",
" f.write(uploaded[\"kaggle.json\"])\n",
" os.chmod(token_file, 600)\n",
"\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment