Kaggle API

Kaggle API was released one year ago but I have not tried it before till now. Mainly because I have trouble finding time to participate in Kaggle competitions. Now I'm trying to look at this year's WiDS datathon (I participated the previous year and thought it was a great experience but I didn't have the time to participate this year, hence the 'Late Submission'.)

There are quite a few ways that the API could be used for, and for a start, I tried using it to download the data used for the competition. Of course, there isn't a need to use the API to download, as you can always use the "Download All" button there, but sometimes coding is more fun than clicking (and vice versa).

Before we can use the API, we have to install it (in Python 3). The instructions can be found here but you can also follow through what I did following the instructions in this post.

I ran the command line to download the data but ran into an error because I did not create a file containing my API credentials.

We have to go to the 'Account' tab of our user profiles and select 'Create API Token' (or 'Create New API Token', in my case). A file named 'kaggle.json' will download automatically.

After putting it into the right directory ('C:\Users\HuiXiang\.kaggle' in my case), the download works.

Using Kaggle API, the csv files and zipped folders were downloaded individually.

If we use the Download button, the files and zipped folders were further zipped into a single .zip file ('widsdatathon2019.zip').