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


Python PrivateKey.set_oauth方法代码示例

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


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

示例1: create

# 需要导入模块: from models.private_key import PrivateKey [as 别名]
# 或者: from models.private_key.PrivateKey import set_oauth [as 别名]
 def create(self, oauth_key, api_key):
     """Set the private keys."""
     if not users.is_current_user_admin():
         handlers.http_error(403, "Only admins may set the private keys.")
     PrivateKey.set_oauth(oauth_key)
     PrivateKey.set_api(api_key)
     handlers.flash("Private keys set successfully.")
     raise cherrypy.HTTPRedirect("/admin#tab-private-keys")
开发者ID:a14n,项目名称:pub-dartlang,代码行数:10,代码来源:private_keys.py

示例2: setUp

# 需要导入模块: from models.private_key import PrivateKey [as 别名]
# 或者: from models.private_key.PrivateKey import set_oauth [as 别名]
    def setUp(self):
        """Initialize stubs for testing.

        This initializes the following fields:
          self.testbed: An App Engine Testbed used for mocking App Engine
            services. This is activated, and any necessary stubs are
            initialized.
          self.testapp: A webtest.TestApp wrapping the CherryPy application.

        Subclasses that define their own setUp method should be sure to call
        this one as well.
        """

        self.__users = {}
        self.__admins = {}

        self.testbed = Testbed()
        self.testbed.activate()
        self.testbed.init_app_identity_stub()
        self.testbed.init_blobstore_stub()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_files_stub()
        self.testbed.init_memcache_stub()
        self.testbed.init_taskqueue_stub()
        self.testbed.init_user_stub()

        self.testapp = webtest.TestApp(Application())

        # These private keys are not used for anything other than testing.
        PrivateKey.set_oauth('''-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,CEB8C6541017AC8B

q1SgqAfgHXK5cQvtdIF8rkSlbAS6a92T5tYMVKJIW24giF5cw+1++X7X6S5ECykC
/iECExP7WfVlPDVoJMZpWGsYLMPhxncnKfUDICbVgwsO4KKeEv8lYTrvkY1sCZIx
kSja/lGAWpyxBnmxwoLh0LbLJBGUxUgn2Uqv/8Iid+w0m3NlgrllV+kOo4gUYF9q
bestH4nEQj6F0CeI8VPW0FxzMwn0vreHFBT5hul6xbNdB1vnRcz6ed4FiGXoAB5K
/8/Q2qyy1UPe2Hr9IoC6wo4h2kXq7pmhy/rtzU9/gjsGPD33ByavbgHAen0ajY5p
RmCx0AGidK9T6/SNoyDD9CMq7ypL+0JWoCeVoAEw2aZqN4rMJNbKMgPH+ajgiAXe
AWuMVjWN6uTL5+QJmWQct6a6TF8GPKdTcOZfNIXU5U9drHB2hggLcy6XkCYGjVJv
MvLascE4oAtOHnwz7WhrpcmX6F6Fww+TPnFzjk+IGJrnBUnAArEcM13IjiDUgg9B
iLuKimwrqasdBBY3Ua3SRMoG8PJoNKdsk1hDGlpxLnqOVUCvPKZuz4QnFusnUJrR
kiv+aqVBpZYymMh2Q1MWcogA7rL7LIowAkyLzS8dNwDhyk9jbO+1uoFSHKr5BTNv
cMJfCVm8pqhXwCVx3uYnhUzvth7mcEseXh5Dcg1RHka5rCXUz4eVxTkj1u3FOy9o
9jgARPpnDYsXH1lESxmiNZucHa50qI/ezNvQx8CbNa1/+JWoZ77yqM9qnDlXUwDY
1Sxqx9+4kthG9oyCzzUwFvhf1kTEHd0RfIapgjJ16HBQmzLnEPtjPA==
-----END RSA PRIVATE KEY-----''')

        PrivateKey.set_api('not a real API key')

        self.dont_be_oauth_user()
开发者ID:a14n,项目名称:pub-dartlang,代码行数:53,代码来源:testcase.py


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