def message(xml): dom = minidom.parseString(xml) root = dom.firstChild children = [node for node in root.childNodes if node.nodeType == 1] mes_type = children[3].childNodes[0].data uid = children[1].childNodes[0].data me = children[0].childNodes[0].data status = user_status(uid,1,g) mes = "想跟我聊天?直接输入文字就好了" if mes_type == 'text': text = children[4].childNodes[0].data if text == 'Hello2BizUser': mes = "欢迎您关注中大信科学生会的微信!\n\n您可以通过#加吐嘈内容向我们提任何意见,我们将会及时回复。十分欢迎您对信科学生会的工作提出质疑与建议。此外,您可以输入任何文字跟我聊天,打发闲暇时间。\n\n信科女生节「逸仙传说」微信游戏正式上线!一个信科女神的奇幻故事,一段尘封许久的逸仙传说,一次精彩绝伦的冒险之旅!回复“女神冒险”开始一次伟大的冒险旅程!\n\n你的希望,我的可能!\nYour will, we will!" elif text[0] == '#': mes = advise(text[1:]) elif text == '女神冒险' or not status == 'new' : mes = game(uid,text,g) else : mes = get_response(text) word_list = mes.split('#e#') if len(word_list) == 2 : return replypic % (uid,me,'%d' % (int(time.time())),word_list[1],word_list[0],word_list[0]) return replytext % (uid,me,'%d' % (int(time.time())),word_list[0])
def _on_status_ready(self, parent, operation, response): # noqa service_model = self.sqs_connection.meta.service_model if response.status == 200: httpres, _ = get_response(service_model.operation_model(operation), response.response) return httpres.code else: raise self._for_status(response, response.read())
def _on_list_ready(self, parent, markers, operation, response): # noqa service_model = self.sqs_connection.meta.service_model if response.status == 200: _, parsed = get_response(service_model.operation_model(operation), response.response) return parsed else: raise self._for_status(response, response.read())
def _on_status_ready(self, parent, operation, response): # noqa service_model = self.sqs_connection.meta.service_model if response.status == 200: httpres, _ = get_response( service_model.operation_model(operation), response.response ) return httpres.code else: raise self._for_status(response, response.read())
def _on_list_ready(self, parent, markers, operation, response): # noqa service_model = self.sqs_connection.meta.service_model if response.status == 200: _, parsed = get_response( service_model.operation_model(operation), response.response ) return parsed else: raise self._for_status(response, response.read())