本文整理汇总了Python中config.Configuration.integration_url方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.integration_url方法的具体用法?Python Configuration.integration_url怎么用?Python Configuration.integration_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.Configuration
的用法示例。
在下文中一共展示了Configuration.integration_url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def __init__(self, data_source_name, list_name, metadata_client=None,
overwrite_old_data=False,
annotation_field='text',
annotation_author_name_field='name',
annotation_author_affiliation_field='location',
first_appearance_field='timestamp',
**kwargs
):
super(CustomListFromCSV, self).__init__(data_source_name, **kwargs)
self.foreign_identifier = list_name
self.list_name = list_name
self.overwrite_old_data=overwrite_old_data
if not metadata_client:
metadata_url = Configuration.integration_url(
Configuration.METADATA_WRANGLER_INTEGRATION,
required=True
)
metadata_client = SimplifiedOPDSLookup(metadata_url)
self.metadata_client = metadata_client
self.annotation_field = annotation_field
self.annotation_author_name_field = annotation_author_name_field
self.annotation_author_affiliation_field = annotation_author_affiliation_field
self.first_appearance_field = first_appearance_field
示例2: setup
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [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)
示例3: __init__
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def __init__(self, _db, name="Axis 360 Circulation Monitor",
interval_seconds=60, batch_size=50):
super(Axis360CirculationMonitor, self).__init__(
_db, name, interval_seconds=interval_seconds,
default_start_time = self.VERY_LONG_AGO
)
self.batch_size = batch_size
metadata_wrangler_url = Configuration.integration_url(
Configuration.METADATA_WRANGLER_INTEGRATION
)
if metadata_wrangler_url:
self.metadata_wrangler = SimplifiedOPDSLookup(metadata_wrangler_url)
else:
# This should only happen during a test.
self.metadata_wrangler = None
示例4: __init__
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def __init__(self, _db, service_name=None, lookup=None, **kwargs):
service_name = service_name or self.DEFAULT_SERVICE_NAME
if not lookup:
content_server_url = (
Configuration.integration_url(
Configuration.CONTENT_SERVER_INTEGRATION
)
)
lookup = SimplifiedOPDSLookup(content_server_url)
output_source = DataSource.lookup(
_db, DataSource.OA_CONTENT_SERVER
)
super(ContentServerBibliographicCoverageProvider, self).__init__(
service_name, input_identifier_types=None,
output_source=output_source, lookup=lookup,
expect_license_pool=True, presentation_ready_on_success=True,
**kwargs
)
示例5: __init__
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def __init__(self, _db, content_lookup=None, cutoff_time=None):
self._db = _db
if not content_lookup:
content_server_url = (
Configuration.integration_url(
Configuration.CONTENT_SERVER_INTEGRATION)
)
content_lookup = SimplifiedOPDSLookup(content_server_url)
self.content_lookup = content_lookup
self.coverage_source = DataSource.lookup(
self._db, DataSource.OA_CONTENT_SERVER
)
super(OpenAccessDownloadURLCoverageProvider, self).__init__(
self.service_name,
None,
self.coverage_source,
workset_size=50,
cutoff_time=cutoff_time
)
示例6: run
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def run():
debug = True
url = Configuration.integration_url(
Configuration.CIRCULATION_MANAGER_INTEGRATION, required=True)
scheme, netloc, path, parameters, query, fragment = urlparse.urlparse(url)
if ':' in netloc:
host, port = netloc.split(':')
port = int(port)
else:
host = netloc
port = 80
# Workaround for a "Resource temporarily unavailable" error when
# running in debug mode with the global socket timeout set by isbnlib
if debug:
import socket
socket.setdefaulttimeout(None)
logging.info("Starting app on %s:%s", host, port)
app.run(debug=debug, host=host, port=port)
示例7: create_authentication_document
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def create_authentication_document(self):
"""Create the OPDS authentication document to be used when
there's a 401 error.
"""
base_opds_document = Configuration.base_opds_authentication_document()
auth_type = [OPDSAuthenticationDocument.BASIC_AUTH_FLOW]
custom_auth_types = {}
for provider in self.oauth_providers:
type = "http://librarysimplified.org/authtype/%s" % provider.NAME
custom_auth_types[type] = provider
auth_type.append(type)
circulation_manager_url = Configuration.integration_url(
Configuration.CIRCULATION_MANAGER_INTEGRATION, required=True)
scheme, netloc, path, parameters, query, fragment = (
urlparse.urlparse(circulation_manager_url))
opds_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, str(netloc)))
links = {}
for rel, value in (
("terms-of-service", Configuration.terms_of_service_url()),
("privacy-policy", Configuration.privacy_policy_url()),
("copyright", Configuration.acknowledgements_url()),
("about", Configuration.about_url()),
):
if value:
links[rel] = dict(href=value, type="text/html")
doc = OPDSAuthenticationDocument.fill_in(
base_opds_document, auth_type, unicode(_("Library")), opds_id, None, unicode(_("Barcode")),
unicode(_("PIN")), links=links
)
for type, provider in custom_auth_types.items():
provider_info = dict(
authenticate=provider.authenticate_url(),
)
doc[type] = provider_info
return json.dumps(doc)
示例8: feed_from_custom_list
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import integration_url [as 别名]
def feed_from_custom_list(list_identifier):
return app.content_server.opds_feeds.custom_list_feed(list_identifier)
@app.route('/lookup')
def lookup():
return URNLookupController(app.content_server._db).work_lookup(ContentServerAnnotator)
# Controllers used for operations purposes
@app.route('/heartbeat')
@returns_problem_detail
def hearbeat():
return HeartbeatController().heartbeat()
if __name__ == '__main__':
debug = True
url = Configuration.integration_url(
Configuration.CONTENT_SERVER_INTEGRATION, required=True)
scheme, netloc, path, parameters, query, fragment = urlparse.urlparse(url)
if ':' in netloc:
host, port = netloc.split(':')
port = int(port)
else:
host = netloc
port = 80
# Workaround for a "Resource temporarily unavailable" error when
# running in debug mode with the global socket timeout set by isbnlib
if debug:
import socket
socket.setdefaulttimeout(None)
app.content_server.log.info("Starting app on %s:%s", host, port)