Rewrite the emitter

* Use requests instead of urllib2 as we’re now bundling requests
* Catch json encoding error when non printable characters are in the
payload and strip these bad characters before encoding the payload

Fix #818 Fix #1004
Fix conflicts