Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

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

Open
brandly opened this issue Jan 26, 2018 · 0 comments
Open

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

brandly opened this issue Jan 26, 2018 · 0 comments

Comments

@brandly
Copy link

brandly commented Jan 26, 2018

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:

entry_form_resp_message = browser.post(
entry_form_url,
data=json.dumps({
'blobFileTokens': [token],
'submissionDescription': message if message else ''
}),
headers={
'Content-Type': 'application/json'
}
).json()

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! 🌟

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant