Handle issues decoding requests more gracefully

Clean up some pep8/pylint violations as well
Add in the ability to handle malformed return urls.