コード例 #1
0
def makeService(config):
    """
    Make the FeedPollerService that will polling AtomHopper.
    """
    s = MultiService()

    config = json.loads(open(config['config']).read())

    agent = Agent(reactor, pool=HTTPConnectionPool(reactor, persistent=True))

    for service_name, service_desc in config['services'].iteritems():
        for url in service_desc['urls']:
            fps = FeedPollerService(
                agent,
                str(url),
                [namedAny(h) for h in service_desc.get('event_handlers', [])],
                state_store=FileStateStore(hashlib.md5(url).hexdigest()))
            fps.setServiceParent(s)

    return s
コード例 #2
0
ファイル: tap.py プロジェクト: MariaAbrahms/otter
def makeService(config):
    """
    Make the FeedPollerService that will polling AtomHopper.
    """
    s = MultiService()

    config = json.loads(open(config['config']).read())

    agent = Agent(reactor, pool=HTTPConnectionPool(reactor, persistent=True))

    for service_name, service_desc in config['services'].iteritems():
        for url in service_desc['urls']:
            fps = FeedPollerService(
                agent,
                str(url),
                [namedAny(h)
                 for h in service_desc.get('event_handlers', [])],
                state_store=FileStateStore(hashlib.md5(url).hexdigest()))
            fps.setServiceParent(s)

    return s