Lines 119-125
class Message(object):
|
Link Here
|
---|
|
119 |
if _type == Message.REQUEST: |
119 |
if _type == Message.REQUEST: |
120 |
type = b'REQUEST' |
120 |
type = b'REQUEST' |
121 |
if mimetype == MIMETYPE_JSON: |
121 |
if mimetype == MIMETYPE_JSON: |
122 |
data = json.dumps(body) |
122 |
try: |
|
|
123 |
data = json.dumps(body) |
124 |
except ValueError as exc: |
125 |
raise Exception(repr(body), str(exc)) |
123 |
if not isinstance(data, bytes): # Python 3 |
126 |
if not isinstance(data, bytes): # Python 3 |
124 |
data = data.encode('utf-8') |
127 |
data = data.encode('utf-8') |
125 |
else: |
128 |
else: |