设为首页 加入收藏

TOP

我的Python开发之路---微信网页授权(扫码登陆)(三)
2017-10-09 13:34:57 】 浏览:7828
Tags:Python 开发 --- 网页 授权 登陆
:
133 try: 134 # conn = MySQLdb.connect(host='localhost', user='root', passwd='123456', db='shang', port=3306) 135 cur = self.conn.cursor() 136 cur.execute('select * from register WHERE Openid=%s ' % self.openid) 137 rows = cur.fetchall() 138 if rows: 139 return True 140 else: 141 print "Please register with the registration page" 142 cur.close() 143 self.conn.close() 144 except MySQLdb.Error, e: 145 print "Mysql Error %d: %s" % (e.args[0], e.args[1]) 146 147 def Judge_tel(self): 148 try: 149 # conn = MySQLdb.connect(host='localhost', user='root', passwd='123456', db='shang', port=3306) 150 cur = self.conn.cursor() 151 cur.execute('select * from register WHERE Tel=%s ' % self.tel) 152 rows = cur.fetchall() 153 if rows: 154 return True 155 else: 156 print "Please enter the telephone number again" 157 cur.close() 158 self.conn.close() 159 except MySQLdb.Error, e: 160 print "Mysql Error %d: %s" % (e.args[0], e.args[1]) View Code

        一开始我是以为所有步骤都要走一遍,后来发现在我所做的实际操作里我只需要获取到openid就可以,换而言之就是我只需要用过code换区网页授权access_token,从中拿到openid,从而验证的这个验证或者绑定的过程就可以完成。

        当然,如果你想要更加合理无误的话,却是需要更加复杂和完善的操作。

        

 

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Python学习——Python进程 下一篇学习笔记TF029:实现进阶卷积网络

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目