floydwch / kaggle-cli

(Deprecated, use https://github.com/Kaggle/kaggle-api instead) An unofficial Kaggle command line tool.
MIT License
674 stars 92 forks source link

no feedback if you haven't accepted competition rules #68

Open brandly opened 6 years ago

brandly commented 6 years ago

the README mentions

Please note that you must accept the competition rules on the competition's page before running your commands.

but it would be nice if the CLI gave you feedback to point you in the right direction. for instance, when trying to submit to a competition without having accepted the rules, you'll get something like:

Expecting value: line 1 column 1 (char 0)

this is due to the JSON parsing failing here, since the response body is an HTML document:

https://github.com/floydwch/kaggle-cli/blob/3f6071f1feddb08d6babfcdfd5a90496ae8b26e6/kaggle_cli/submit.py#L73-L82

seems like you could wrap that up:

try:
    # ...response.json()
except ValueError:
    print('You must accept competition rules on the competition's page before submitting to the competition\n{}'.format(competition_url))

linking to the competition_url feels like a nice touch.

thanks for this CLI! 🌟