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


Python Configuration.integration方法代码示例

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


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

示例1: setup

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
    def setup(self):
        Configuration.load()
        self.url = Configuration.integration_url(Configuration.CIRCULATION_MANAGER_INTEGRATION)

        millenium = Configuration.integration(Configuration.MILLENIUM_INTEGRATION)
        self.test_username = millenium.get(Configuration.AUTHENTICATION_TEST_USERNAME)
        self.test_password = millenium.get(Configuration.AUTHENTICATION_TEST_PASSWORD)
开发者ID:datalogics-tsmith,项目名称:circulation,代码行数:9,代码来源:__init__.py

示例2: from_environment

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
 def from_environment(cls, redirect_uri, test_mode=False):
     if test_mode:
         return cls('/path', '/callback', test_mode)
     config = dict(Configuration.integration(
         Configuration.GOOGLE_OAUTH_INTEGRATION
     )['web'])
     return cls(config, redirect_uri, test_mode)
开发者ID:dguo,项目名称:circulation,代码行数:9,代码来源:oauth.py

示例3: from_config

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
 def from_config(cls):
     config = Configuration.integration(cls.FIRSTBOOK, required=True)
     host = config.get(Configuration.URL)
     key = config.get(cls.SECRET_KEY)
     if not host:
         cls.log.warning("No First Book client configured.")
         return None
     return cls(host, key)
开发者ID:datalogics-tsmith,项目名称:circulation,代码行数:10,代码来源:firstbook.py

示例4: from_environment

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
 def from_environment(cls):
     config = Configuration.integration(
         Configuration.MILLENIUM_INTEGRATION, required=True)
     host = config.get(Configuration.URL)
     if not host:
         cls.log.info("No Millenium Patron client configured.")
         return None
     return cls(host)            
开发者ID:datalogics-tsmith,项目名称:circulation,代码行数:10,代码来源:millenium_patron.py

示例5: from_environment

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
 def from_environment(cls, redirect_uri, test_mode=False):
     if test_mode:
         return cls('/path', '/callback', test_mode)
     config = Configuration.integration(
         Configuration.GOOGLE_OAUTH_INTEGRATION
     )
     client_json_file = config[Configuration.GOOGLE_OAUTH_CLIENT_JSON]
     return cls(client_json_file, redirect_uri, test_mode)
开发者ID:datalogics-tsmith,项目名称:circulation,代码行数:10,代码来源:oauth.py

示例6: import

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
database as ExternalIntegrations
"""

import os
import sys
import logging
from nose.tools import set_trace

bin_dir = os.path.split(__file__)[0]
package_dir = os.path.join(bin_dir, "..")
sys.path.append(os.path.abspath(package_dir))

from config import Configuration
from model import (
    ExternalIntegration as EI,
    production_session,
)
_db = production_session()
log = logging.getLogger(name="Log configuration import")
loggly_conf = Configuration.integration(u'loggly')

if loggly_conf:
    integration = EI(goal=EI.LOGGING_GOAL, protocol=EI.LOGGLY)
    _db.add(integration)
    integration.url = loggly_conf.get(
        'url', 'https://logs-01.loggly.com/inputs/%(token)s/tag/python/'
    )
    integration.password = loggly_conf.get('token')
_db.commit()

开发者ID:NYPL-Simplified,项目名称:server_core,代码行数:31,代码来源:20170926-migrate-log-configuration.py

示例7: log_import

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
    production_session,
)

from s3 import S3Uploader

log = logging.getLogger(name="Core configuration import")

def log_import(integration_or_setting):
    log.info("CREATED: %r" % integration_or_setting)

try:
    Configuration.load()
    _db = production_session()

    # Import CDN configuration.
    cdn_conf = Configuration.integration(u'CDN')

    if cdn_conf and isinstance(cdn_conf, dict):
        for k, v in cdn_conf.items():
            cdn = EI(protocol=EI.CDN, goal=EI.CDN_GOAL)
            _db.add(cdn)
            cdn.url = unicode(v)
            cdn.setting(Configuration.CDN_MIRRORED_DOMAIN_KEY).value = unicode(k)
            log_import(cdn)

    # Import Elasticsearch configuration.
    elasticsearch_conf = Configuration.integration(u'Elasticsearch')
    if elasticsearch_conf:
        url = elasticsearch_conf.get('url')
        works_index = elasticsearch_conf.get(ExternalSearchIndex.WORKS_INDEX_KEY)
开发者ID:NYPL-Simplified,项目名称:server_core,代码行数:32,代码来源:20170713-18-move-third-party-config-to-external-integrations.py

示例8: production_session

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
    log.info("CREATED: %r" % integration_or_setting)


_db = production_session()
try:
    Configuration.load()
    library = Library.default(_db)
    if not library:
        library, ignore = create(
            _db, Library, name=u'default', short_name=u'default',
            uuid=unicode(uuid.uuid4())
        )
        library.is_default = True

    # Create the Bibblio integration.
    bibblio_conf = Configuration.integration('Bibblio')
    if bibblio_conf:
        bibblio = EI(
            name=EI.BIBBLIO,
            protocol=EI.BIBBLIO,
            goal=EI.METADATA_GOAL
        )
        _db.add(bibblio)
        bibblio.username = bibblio_conf.get('client_id')
        bibblio.password = bibblio_conf.get('client_secret')
        log_import(bibblio)

    # Create the Metadata Wrangler configuration.
    metadata_wrangler_conf = Configuration.integration('Metadata Wrangler')
    if metadata_wrangler_conf:
        wrangler = EI(
开发者ID:NYPL-Simplified,项目名称:content_server,代码行数:33,代码来源:20170714-1-move-third-party-config-to-external-integrations.py

示例9: from_config

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
 def from_config(cls):
     config = Configuration.integration(cls.NAME, required=True)
     client_id = config.get(Configuration.OAUTH_CLIENT_ID)
     client_secret = config.get(Configuration.OAUTH_CLIENT_SECRET)
     return cls(client_id, client_secret)
开发者ID:dguo,项目名称:circulation,代码行数:7,代码来源:clever.py

示例10: loadstorm_verify

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration [as 别名]
def loadstorm_verify(code):
    c = Configuration.integration("Loadstorm", required=True)
    if code == c['verification_code']:
        return Response("", 200)
    else:
        return Response("", 404)
开发者ID:dguo,项目名称:circulation,代码行数:8,代码来源:routes.py


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