def input(self):
try:
encoded = ''.join(self.body)
if len(encoded) == 0:
return None
unpacker = self.content_types[self.content_type]
data = unpacker(encoded)
except KeyError:
raise HTTPError(409, 'Bad/missing mime type (%s) - use one of: %s' % (self.content_type, ', '.join(self.content_types.keys())))
except ValueError:
raise HTTPError(400, 'Decode failed for mime type: %s' % self.content_type)
except HTTPError:
raise
except Exception as e:
info = sys.exc_info()
log.error('Unhandled exception: %s', traceback.print_exception(*info))
raise HTTPError(409, 'Bad data - %s decode failed' % self.content_type)
return data
# called for each request
评论列表
文章目录