Sort imports.
Split option parsing and rest into a main method.
Indent custom keys.

Only one key per line.
Rename variable and remove comment.
Using sys.exit instead of just exit.

Just exit may not be there during runtime.
Make use of a logger instead of many if-print constructs.
Reading the credentials put into an extra function.
Checking for API version now in own function.
Better readability.
customKeys is now a constant.
Fix logging.
Pythonic truth testing.
Reset the resultcode on every iteration.
Convert this to string only once.
Using str.format
Re-classiy logmessages.