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. mysql 查詢身份證號字段值有效的數據2. 請教使用PDO連接MSSQL數據庫插入是亂碼問題?3. 視頻文件不能播放,怎么辦?4. flask - python web中如何共享登錄狀態?5. python如何不改動文件的情況下修改文件的 修改日期6. python - 數據與循環次數對應不上7. node.js - nodejs開發中常用的連接mysql的庫8. python - 我在使用pip install -r requirements.txt下載時,為什么部分能下載,部分不能下載9. mysql - 把一個表中的數據count更新到另一個表里?10. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處
