python - 已关注粉丝再次扫描微信带参数二维码报错
问题描述
已关注粉丝再次扫描微信带参数二维码报错。未关注粉丝扫描二维码时,正常。第二次扫描时,提示“无法服务”
查后台nginx日志 两种场景均返回的为空,CODE 为200
@app.route('/',methods=['POST','GET','PUT'])def index(): if(request.method=='GET'): #验证微信signature=request.args.get(’signature’, None)timestamp=request.args.get(’timestamp’,None)nonce=request.args.get(’nonce’,None)echostr=request.args.get(’echostr’,'hello')# logging.info(echostr)return echostr if(request.method=='POST'):soup=BeautifulSoup(request.data,'xml')logging.info('POST请求n'+str(soup))MsgType=soup.MsgType.stringif(MsgType==’event’): if(soup.Event.string=='SCAN' or soup.Event.string=='subscribe' ):key=soup.EventKey.stringopenid=soup.FromUserName.stringlogging.info('EventKey'+str(key))# 商店管理员扫描if(key.startswith('ownerid')): key=key.split('ownerid')[1] data={'openid':str(openid)} res=requests.put('http://www.example.com/owner/'+key+'/',json=data) return ’’# 商店顾客扫描if(key.startswith('qrscene_')): key=key.split('qrscene_')[1]data={'shopid':key}res=requests.put('http://www.example.com/customer/'+openid+'/',json=data)logging.info(str(res.json()))return '' # WX.notify(soup.FromUserName.string)return '' return ''
问题解答
回答1:你好,请问这个问题你解决了吗?是怎么解决的呢?我现在也遇到了这个问题,不知道怎么办呢,求助
相关文章:
1. linux - 编译安装mysql 5.6.232. angular.js - vue中类似于angular的ng-change的指令是?3. android - 使用vue.js进行原生开发如何进行Class绑定4. node.js - 微信的自动回复问题5. html5 - 在一个页面中 初始了两个swiper 不知道哪里错了 一直不对6. css3 - 请问一下在移动端CSS布局布局中通常需要用到哪些元素,属性?7. PHP能实现百度网盘的自动化么?8. 网页爬虫 - python requests爬虫,如何post payload9. node.js - vue服务端渲染如何部署到线上10. 如何把3个不同的MySQL数据库数据整合到一个MySQL数据库中?
