Handle issues decoding requests more gracefully

Clean up some pep8/pylint violations as well