当前位置: 首页>>代码示例>>Python>>正文


Python Validator.session方法代码示例

本文整理汇总了Python中validator.Validator.session方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.session方法的具体用法?Python Validator.session怎么用?Python Validator.session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在validator.Validator的用法示例。


在下文中一共展示了Validator.session方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: usersites

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import session [as 别名]
    def usersites(self, email, session_id):
        Validator.email(email)
        Validator.session(session_id)

        user = self.user.get(email)
        self.user.validate_session(user['session'], session_id)

        return self.site.get_user_urls(user['id'])
开发者ID:evansims,项目名称:riverid-python,代码行数:10,代码来源:api.py

示例2: sessions

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import session [as 别名]
    def sessions(self, email, session_id):
        Validator.email(email)
        Validator.session(session_id)

        sessions = self.user.get(email)['session']
        found = False

        for session in sessions:
            if session['id'] == session_id and 'stop' not in session:
                found = True
        
        if not found:
            raise RiverException('The session is not valid for this account.')
        
        return sessions
开发者ID:brianherbert,项目名称:riverid,代码行数:17,代码来源:api.py

示例3: addusertosite

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import session [as 别名]
    def addusertosite(self, email, session_id, url):
        Validator.email(email)
        Validator.session(session_id)
        Validator.url(url)

        user = self.user.get(email)
        self.user.validate_session(user['session'], session_id)

        if not self.site.exists(url):
            self.site.add_site(url)

        if url in self.site.get_user_urls(user['id']):
            raise RiverException(_('The site has already been added to this user.'))

        self.site.add_user(url, user['id'])
开发者ID:evansims,项目名称:riverid-python,代码行数:17,代码来源:api.py

示例4: signout

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import session [as 别名]
    def signout(self, email, session_id):
        Validator.email(email)
        Validator.session(session_id)

        sessions = self.user.get(email)['session']
        found = False

        for count, session in enumerate(sessions):
            if session['id'] == session_id:
                if 'stop' in session:
                    raise RiverException('The session has already been ended.')

                found = True
                session_stop = datetime.utcnow().isoformat()
                self.user.update_array(email, 'session', count, 'stop', session_stop)
        
        if not found:
            raise RiverException('The session is not valid for this account.')
开发者ID:brianherbert,项目名称:riverid,代码行数:20,代码来源:api.py


注:本文中的validator.Validator.session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。