V = re.findall( 'UUID = "(*)。");'、response.text)
vが、コンテンツ(*)パケットのリストです
django.shortcuts インポートレンダリング、のHttpResponse インポート要求が インポート時間 インポート再 インポートJSON CTIME = なし QCODE = なし ヒント = 1 ticket_dict = {} デフ:ログイン(リクエスト) グローバルCTIME CTIME = time.time() 応答 = requests.getを( URL = ' https://login.wx.qq.com/jslogin?appid=wx782c26e4c19acffb&fun=new&lang=zh_CN&_=%s '%CTIME ) V = re.findall(' UUID = "(*)"; ' 、response.text) グローバルQCODEの QCODE = V [0] 復帰レンダリング(リクエスト、' login.htmlと' { ' qcode ' :QCODE} ) DEF check_login(リクエスト): グローバルTIPの RET = { ' コード':408、' データ' :なし} R1 = requests.get( URL = "https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid=%s&tip=%s&r=95982085&_=%s "%(QCODE、TIP、CTIME、) ) であれば 「窓.CODE = 408 ' に r1.text: プリント(' 无人扫码' ) リターンのHttpResponse(json.dumps(RET)) のelif ' window.code = 201 ' に r1.text: RET [ ' コード' ] = 201 アバター = re.findall(" window.userAvatar = '(*)。'; " 、R1。テキスト)[0] というタイトルの[' データ' ] = アバター TIP = 0 戻りのHttpResponse(json.dumps(RET)) のelif ' window.code = 200 ' に r1.text: #用户点击确认登录、 ""」 window.code = 200; window.redirect_uri = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?ticket=AYKeKS9YQnNcteZCfLeTlzv7@qrticket_0&uuid=QZA2_kDzdw==&lang=zh_CN&scan=1494553432"; window.redirect_uri = "HTTPS://wx2.qq .COM / CGI-binに/ mmwebwx-binに/ webwxnewloginpageチケット= AYKeKS9YQnNcteZCfLeTlzv7 @ qrticket_0&UUID = QZA2_kDzdw ==&LANG = zh_CNに&スキャン= 1494553432? "; """ REDIRECT_URI= re.findall(' window.redirect_uri = "(*)。"; ' 、r1.text)[0] REDIRECT_URI = REDIRECT_URI + " &楽しい=新しい&バージョン= V2 " #获取凭证 R2 = requests.get(URL = REDIRECT_URI) BS4のインポートBeautifulSoup スープ = BeautifulSoup(r2.text、' html.parser ' ) のためのタグで soup.find(' エラー' :).children ticket_dict [tag.name] = tag.get_text() 印刷(ticket_dict) #获取用户信息 #https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?r=88828930&lang=zh_CN&pass_ticket=uBfBw5um5Zor97ihMqdFprf4kqjecz8q0VRdevL%252BMg7Ozij4NvnpZCevYQX5jhO0 #get_user_info_data = { # 'BaseRequest':{ # 「のDeviceID ': "e402310790089148"、 # 'シド':ticket_dict [' wxsid ']、 # '信号Uin':ticket_dict [' wxuin ']、 # 'SKEY':ticket_dict [' 'SKEY]、 # } #} #get_user_info_url = " https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?r=88828930&lang=zh_CN&pass_ticket=」+ ticket_dict [ 'pass_ticket'] #R3 = requests.post( #の URL = get_user_info_url、 # JSON = get_user_info_data #) #1 r3.encoding = 'UTF-8' #user_init_dict = json.loads(r3.text) #1 プリント(user_init_dict) RET [ ' コード' ] = 200 リターンのHttpResponse(json.dumps(RET))