當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。