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


Python common.generate_token方法代码示例

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


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

示例1: random_token_generator

# 需要导入模块: from oauthlib import common [as 别名]
# 或者: from oauthlib.common import generate_token [as 别名]
def random_token_generator(request, refresh_token=False):
    return common.generate_token() 
开发者ID:kylebebak,项目名称:Requester,代码行数:4,代码来源:tokens.py

示例2: create_authorization_code

# 需要导入模块: from oauthlib import common [as 别名]
# 或者: from oauthlib.common import generate_token [as 别名]
def create_authorization_code(self, request):
        """Generates an authorization grant represented as a dictionary."""
        grant = {'code': common.generate_token()}
        if hasattr(request, 'state') and request.state:
            grant['state'] = request.state
        log.debug('Created authorization code grant %r for request %r.',
                  grant, request)
        return grant 
开发者ID:kylebebak,项目名称:Requester,代码行数:10,代码来源:authorization_code.py

示例3: generate_secret_key

# 需要导入模块: from oauthlib import common [as 别名]
# 或者: from oauthlib.common import generate_token [as 别名]
def generate_secret_key(length=31):
    """ Generates a random secret, as a string."""
    return generate_token(length=length) 
开发者ID:okpy,项目名称:ok,代码行数:5,代码来源:utils.py

示例4: setUp

# 需要导入模块: from oauthlib import common [as 别名]
# 或者: from oauthlib.common import generate_token [as 别名]
def setUp(self, mock_apply_async):
        self.user = BridgeUser.objects.create_user(
            username='test',
            password='test',
            email='test@me.com'
        )
        self.client.login(username='test', password='test')
        # collections
        self.collection1 = Collection.objects.create(name='col1', owner=self.user)
        self.collection2 = Collection.objects.create(name='col2', owner=self.user)
        self.collection3 = Collection.objects.create(name='col3', owner=self.user)
        # grading policies
        self.trials_count = GradingPolicy.objects.get(name='trials_count')
        self.points_earned = GradingPolicy.objects.get(name='points_earned')

        self.engine = Engine.objects.create(engine='engine_mock', engine_name='mockEngine')
        self.test_cg = ModuleGroup.objects.create(name='TestColGroup', owner=self.user)

        self.collection_order1 = CollectionOrder.objects.create(
            slug="collection_order1",
            group=self.test_cg,
            collection=self.collection1,
            engine=self.engine,
            grading_policy=self.points_earned
        )
        self.collection_order3 = CollectionOrder.objects.create(
            slug="collection_order3",
            group=self.test_cg,
            collection=self.collection3,
            engine=self.engine,
            grading_policy=self.trials_count
        )

        self.group_update_data = {
            'name': "CG2",
            'owner': self.user.id,
            'description': 'Some description for a group',
        }

        self.group_post_data = self.add_prefix(self.group_prefix, self.group_update_data)

        # LtiLmsPlatform
        self.lti_lms_platform = LtiLmsPlatform.objects.create(
            consumer_name='consumer_name',
            # This method generates a valid consumer_key.
            # The valid consumer_key is used in the test for checking LTI query.
            consumer_key=generate_token(length=25),
            consumer_secret='consumer_secret',
            expiration_date=datetime.datetime.today() + datetime.timedelta(days=1),
            lms_metadata='lms_metadata'
        ) 
开发者ID:harvard-vpal,项目名称:bridge-adaptivity,代码行数:53,代码来源:test_views.py


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