from httplib.exceptions import BadRequest from httplib.httpsocket import HTTPSocket class ServerSocket(HTTPSocket): """ Wrapper class for a socket. Represents a client connected to this server. """ """ Reads the next line decoded as `httpsocket.FORMAT` @return: the decoded next line retrieved from the socket @raise InvalidResponse: If the next line couldn't be decoded, but was expected to """ def read_line(self): try: return super().read_line() except UnicodeDecodeError: raise BadRequest("UnicodeDecodeError")