Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
log
  • Loading branch information
liufufa committed Mar 21, 2023
1 parent 90a86d4 commit 37566b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def wechat():
if request.method == 'POST':
# 获取微信服务器post过来的xml数据
xml = request.data
print(xml)
try:
# 把xml格式的数据进行处理,转换成字典进行取值
req = xmltodict.parse(xml)['xml'] # 云端调试空内容报错解决:no element found
except:
return 'no element', 200

print(req)
# 判断post过来的数据中数据类型是不是文本
if 'text' == req.get('MsgType'):
# 获取用户的信息,开始构造返回数据
Expand Down

0 comments on commit 37566b8

Please sign in to comment.