(self, code)
return user, data
小程式授权
        :rtype: (wechat_django.models.WeChatUser, dict)
        :raises: wechatpy.exceptions.WeChatClientException
小程式授权
        :rtype: (wechat_django.models.WeChatUser, dict)
        :raises: wechatpy.exceptions.WeChatClientException
小程式授权 : rtype : ( wechat_django . models . WeChatUser dict ) : raises : wechatpy . exceptions . WeChatClientException
def _auth_miniprogram(self, code):
        """小程式授权
        :rtype: (wechat_django.models.WeChatUser, dict)
        :raises: wechatpy.exceptions.WeChatClientException
        """
        from . import Session
        data = self.client.code_to_session(code)
        user = self.users.upsert_by_dict(data)
        # 持久化session_key
        user.sessions.all().delete()
        user.sessions.add(Session(
            type=Session.Type.MINIPROGRAM,
            auth=dict(session_key=data["session_key"])
        ), bulk=False)
        # 移除session缓存
        try:
            del user.session
        except AttributeError:
            pass
        return user, data
def _auth_miniprogram ( self , code ) : from . import Session data = self . client . code_to_session ( code ) user = self . users . upsert_by_dict ( data ) # 持久化session_key user . sessions . all ( ) . delete ( ) user . sessions . add ( Session ( type = Session . Type . MINIPROGRAM , auth = dict ( session_key = data [ "session_key" ] ) ) , bulk = False ) # 移除session缓存 try : del user . session except AttributeError : pass return user , data