Some serious refactoring to use httplib error responses, and cut down on cruft in the code.
Expanded tests to cover use of custom message and payload.