Authorizing access to Kaggle's API

kgl_auth(req = NULL, username = NULL, key = NULL, creds_file = NULL)

Arguments

req

A request.

username

Name associated with user's account at Kaggle.com.

key

Key (a string of random letters and numbers) generated by Kaggle. Users can obtain or lookup their keys by signing into Kaggle and clicking on 'Account" or by substituting their username at kaggle.com/username/account.

creds_file

Path to user's kaggle.json file. See @details for more information.

Details

When Kaggle generates a key, it's sent to users as a kaggle.json file, which is likely saved in a place like the default Downloads folder or something. Users can (a) save the kaggle.json file to a .kaggle directory in the user's machine's home folder (i.e., ~/.kaggle/kaggle.json), (b) specify the path to their kaggle.json file using this creds_file argument, or (c) save their kaggle.json file in their current working directory. The third options (options c) is the least desirable as your working directory will presumably change between sessions where you'd still want to have authorized access to Kaggle's API. Either of the first two options would be a good choice.

Kaggle encourages users to save the "kaggle.json" credentials file in their .kaggle file in their home directory (~/.kaggle/kaggle.json). If all arguments are left NULL (their defaults), this function will look to see if you computer has a ~/.kaggle/kaggle.json file. If it can't find it there, it'll look in the current working directory. If it finds the file, it'll use it. Otherwise it'll look for environment variables, which it will create and save for you manually the first time you enter your username/key or path to your kaggle.json file.