#coding: utf-8
import sae
import web
import xml.etree.ElementTree as ET
urls = (
'/', 'Hello'
)
class Hello:
def GET(self):
data=web.input()
echostr=data.echostr
return echostr
def POST(self):
data=web.data()
root = ET.fromstring(data)
fromUser=root.findtext(".//FromUserName")
toUser=root.findtext(".//ToUserName")
CreateTime=root.findtext(".//CreateTime")
texttpl='''<xml>
<ToUserName>'''+fromUser+'''</ToUserName>
<FromUserName>'''+toUser+'''</FromUserName>
<CreateTime>'''+CreateTime+'''</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[你好]]></Content>
</xml>'''
return texttpl
app = web.application(urls, globals()).wsgifunc()
application = sae.create_wsgi_app(app)