Przeglądaj źródła

add unionid for sp pro

ymao 3 lat temu
rodzic
commit
6914cc3c73
2 zmienionych plików z 7 dodań i 1 usunięć
  1. 6 0
      authen/wxlogin/wx.py
  2. 1 1
      setup.py

+ 6 - 0
authen/wxlogin/wx.py

@@ -330,5 +330,11 @@ class WeixinLogin(object):
         """
         return self.userinfo(access_token, openid)
 
+    def get_sp_unionid(self, code):
+        url = "https://api.weixin.qq.com/sns/jscode2session"
+        args = dict(appid=self.app_id, secret=self.app_secret,
+                    js_code=code, grant_type="authorization_code")
+        return self._get(url, args)
+
 
 wx_login = WeixinLogin()

+ 1 - 1
setup.py

@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
 
 setup(
     name='authen.wxlogin',
-    version=0.59,
+    version=0.60,
     url='http://git.trops-global.com/authen/trops_wxlogin.git',
     license='GPL',
     author='authen',