def do_POST(self):
"""Called when a new event has been received"""
# make sure this is what we expect
if self.path != '/event':
raise RuntimeError('Unexpected path when parsing event: {0}'.format(self.path))
# validate our content type
content_type = self.headers.get('content-type', None)
if content_type != 'text/x-apple-plist+xml':
raise RuntimeError('Unexpected Content-Type when parsing event: {0}'.format(content_type))
# and the body length
content_length = int(self.headers.get('content-length', 0))
if content_length == 0:
raise RuntimeError('Received an event with a zero length body.')
# parse XML plist
self.event = plist_loads(self.rfile.read(content_length))
评论列表
文章目录