コード例 #1
0
ファイル: nyt.py プロジェクト: datalogics-dans/circulation
 def __init__(self, _db, api_key=None, do_get=None, metadata_client=None):
     self._db = _db
     self.api_key = api_key
     self.do_get = do_get or Representation.simple_http_get
     if not metadata_client:
         metadata_client = MetadataWranglerOPDSLookup.from_config(self._db)
     self.metadata_client = metadata_client
コード例 #2
0
ファイル: coverage.py プロジェクト: datalogics/circulation
    def __init__(self, collection, upload_client=None, **kwargs):
        _db = Session.object_session(collection)
        self.upload_client = upload_client or MetadataWranglerOPDSLookup.from_config(
            _db, collection=collection)

        super(MetadataUploadCoverageProvider,
              self).__init__(collection, **kwargs)
        if not self.upload_client.authenticated:
            raise CannotLoadConfiguration(
                "Authentication for the Library Simplified Metadata Wrangler "
                "is not set up. You can't upload metadata without authenticating."
            )
コード例 #3
0
ファイル: coverage.py プロジェクト: datalogics/circulation
    def __init__(self, collection, lookup_client=None, **kwargs):
        _db = Session.object_session(collection)
        lookup_client = lookup_client or MetadataWranglerOPDSLookup.from_config(
            _db, collection=collection)

        super(MetadataWranglerCoverageProvider,
              self).__init__(collection, lookup_client, **kwargs)
        if not self.lookup_client.authenticated:
            self.log.warn(
                "Authentication for the Library Simplified Metadata Wrangler "
                "is not set up. You can still use the metadata wrangler, but "
                "it will not know which collection you're asking about.")
コード例 #4
0
 def __init__(self, _db, collection, lookup=None):
     super(MetadataWranglerCollectionMonitor, self).__init__(
         _db, collection
     )
     self.lookup = lookup or MetadataWranglerOPDSLookup.from_config(
         self._db, collection=collection
     )
     self.importer = OPDSImporter(
         self._db, self.collection,
         data_source_name=DataSource.METADATA_WRANGLER,
         metadata_client=self.lookup, map_from_collection=True,
     )
コード例 #5
0
 def __init__(self, _db, collection, lookup=None):
     super(MetadataWranglerCollectionMonitor,
           self).__init__(_db, collection)
     self.lookup = lookup or MetadataWranglerOPDSLookup.from_config(
         self._db, collection=collection)
     self.importer = OPDSImporter(
         self._db,
         self.collection,
         data_source_name=DataSource.METADATA_WRANGLER,
         metadata_client=self.lookup,
         map_from_collection=True,
     )
コード例 #6
0
ファイル: nyt.py プロジェクト: pic-ed/LibrarySimplifies
 def __init__(self, _db, api_key=None, do_get=None, metadata_client=None):
     self.log = logging.getLogger("NYT API")
     self._db = _db
     if not api_key:
         raise CannotLoadConfiguration("No NYT API key is specified")
     self.api_key = api_key
     self.do_get = do_get or Representation.simple_http_get
     if not metadata_client:
         try:
             metadata_client = MetadataWranglerOPDSLookup.from_config(
                 self._db)
         except CannotLoadConfiguration, e:
             self.log.error(
                 "Metadata wrangler integration is not configured, proceeding without one."
             )
コード例 #7
0
 def __init__(self, collection, lookup_client=None, **kwargs):
     """Since we are processing a specific collection, we must be able to
     get an _authenticated_ metadata wrangler lookup client for the
     collection.
     """
     _db = Session.object_session(collection)
     lookup_client = lookup_client or MetadataWranglerOPDSLookup.from_config(
         _db, collection=collection)
     super(BaseMetadataWranglerCoverageProvider,
           self).__init__(collection, lookup_client, **kwargs)
     if not self.lookup_client.authenticated:
         raise CannotLoadConfiguration(
             "Authentication for the Library Simplified Metadata Wrangler "
             "is not set up. Without this, there is no way to register "
             "your identifiers with the metadata wrangler.")
コード例 #8
0
ファイル: nyt.py プロジェクト: NYPL-Simplified/circulation
 def __init__(self, _db, api_key=None, do_get=None, metadata_client=None):
     self.log = logging.getLogger("NYT API")
     self._db = _db
     if not api_key:
         raise CannotLoadConfiguration("No NYT API key is specified")
     self.api_key = api_key
     self.do_get = do_get or Representation.simple_http_get
     if not metadata_client:
         try:
             metadata_client = MetadataWranglerOPDSLookup.from_config(
                 self._db
             )
         except CannotLoadConfiguration, e:
             self.log.error(
                 "Metadata wrangler integration is not configured, proceeding without one."
             )
コード例 #9
0
 def __init__(self, collection, lookup_client=None, **kwargs):
     """Since we are processing a specific collection, we must be able to
     get an _authenticated_ metadata wrangler lookup client for the
     collection.
     """
     _db = Session.object_session(collection)
     lookup_client = lookup_client or MetadataWranglerOPDSLookup.from_config(
         _db, collection=collection
     )
     super(BaseMetadataWranglerCoverageProvider, self).__init__(
         collection, lookup_client, **kwargs
     )
     if not self.lookup_client.authenticated:
         raise CannotLoadConfiguration(
             "Authentication for the Library Simplified Metadata Wrangler "
             "is not set up. Without this, there is no way to register "
             "your identifiers with the metadata wrangler."
         )
コード例 #10
0
    def __init__(self,
                 _db,
                 collection,
                 api_class=Axis360API,
                 metadata_client=None):
        super(Axis360CirculationMonitor, self).__init__(_db, collection)
        if isinstance(api_class, Axis360API):
            # Use a preexisting Axis360API instance rather than
            # creating a new one.
            self.api = api_class
        else:
            self.api = api_class(collection)
        if not metadata_client:
            metadata_client = MetadataWranglerOPDSLookup.from_config(
                _db, collection=collection)

        self.batch_size = self.DEFAULT_BATCH_SIZE
        self.metadata_client = metadata_client
        self.bibliographic_coverage_provider = (
            Axis360BibliographicCoverageProvider(collection,
                                                 api_class=self.api))
コード例 #11
0
 def __init__(self, metadata_web_app_url=None):
     if metadata_web_app_url:
         self.lookup = MetadataWranglerOPDSLookup(metadata_web_app_url)
     else:
         self.lookup = MetadataWranglerOPDSLookup.from_config(_db)
コード例 #12
0
ファイル: monitor.py プロジェクト: datalogics/circulation
 def __init__(self, _db, collection, lookup=None):
     super(MetadataWranglerCollectionUpdateMonitor,
           self).__init__(_db, collection)
     self.lookup = lookup or MetadataWranglerOPDSLookup.from_config(
         self._db, collection=collection)