lepture/python-livereload — pull request #67 by skitazaki (2014-06-05 16:26:09+00:00)
Title: Fix error to send image file on Python 3.x

On Python 3.x, we have to treat binary and text separately.

If we open image file with only 'r' mode option, we encounter following error.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

And if we open text file with 'rb' mode option, we encounter following error.

TypeError: expected bytes, bytearray or buffer compatible object

This patch checks guessed `mime_type` along with [Media Types](http://www.iana.org/assignments/media-types/media-types.xhtml) rules. I tested with Python 3.4 and Python 2.7 on MacOSX.