Example #1
0
 def __init__(self, _db, content_server=None):
     self._db = _db
     if not content_server:
         content_server_url = Configuration.integration_url(
             Configuration.CONTENT_SERVER_INTEGRATION, required=True)
         content_server = SimplifiedOPDSLookup(content_server_url)
     self.content_server = content_server
     self.importer = OPDSImporter(self._db, DataSource.OA_CONTENT_SERVER)
     input_identifier_types = [Identifier.GUTENBERG_ID, Identifier.URI]
     output_source = DataSource.lookup(
         self._db, DataSource.OA_CONTENT_SERVER
     )
     super(ContentServerCoverageProvider, self).__init__(
             "OA Content Server Coverage Provider",
             input_identifier_types, output_source, batch_size=10
     )
Example #2
0
    return CanonicalizationController(Conf.db).canonicalize_author_name()

@app.route('/updates')
@requires_auth
def updates():
    return CollectionController(Conf.db).updates_feed()

@app.route('/remove', methods=['POST'])
@requires_auth
def remove():
    return CollectionController(Conf.db).remove_items()

if __name__ == '__main__':

    debug = True
    url = Configuration.integration_url(
        Configuration.METADATA_WRANGLER_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)

    Conf.log.info("Starting app on %s:%s", host, port)
Example #3
0
 def __init__(self):
     self.base_url = Configuration.integration_url(self.SERVICE_NAME)