rabin 7 years ago
parent
commit
8b489f1a82
1 changed files with 9 additions and 2 deletions
  1. 9 2
      front/api/login.py

+ 9 - 2
front/api/login.py

@@ -7,6 +7,8 @@
 """
 from __load__ import *
 import json
+import urllib
+import urllib2
 
 class login_path(Load):
 	"""
@@ -28,6 +30,7 @@ class login_path(Load):
 	"""
 	@Web.setting
 	def get(self):
+ 
 		mobile = self.input('mobile')
 		password = self.input('password')
 		if mobile and password:
@@ -57,8 +60,12 @@ class login_path(Load):
 		url = url + '&secret=' + Demeter.config['weixinApp']['secret']
 		url = url + '&js_code=' + code
 		url = url + '&grant_type=authorization_code'
-		data = Demeter.curl(url)
-		data = json.loads(data.body)
+		req = urllib2.Request(url)
+		response = urllib2.urlopen(req)
+		data = json.loads(response.read())
+		#data = Demeter.curl(url)
+		#data = json.loads(data.body)
+		print data
 		if 'errcode' in data:
 			return False
 		update = {}