pep8 fixes
test for invalid endpoint (thanks @jerith)