From 39665058d2131af960e87c26ea8fabb15b34ef84 Mon Sep 17 00:00:00 2001 From: Deimos Date: Fri, 15 Mar 2019 19:21:30 -0600 Subject: [PATCH] Embedly consumer: switch to get_appsettings() Using bootstrap() seems to cause issues with re-declaring the Prometheus metrics (which happens in the tweens that we don't really need or want anyway). There might be better ways to do this including not attaching the tweens for scripts, but this seems to work fine (and was already being done this way in the YouTube API consumer). --- tildes/consumers/topic_embedly_extractor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tildes/consumers/topic_embedly_extractor.py b/tildes/consumers/topic_embedly_extractor.py index 67c006a..5fba99a 100644 --- a/tildes/consumers/topic_embedly_extractor.py +++ b/tildes/consumers/topic_embedly_extractor.py @@ -8,7 +8,7 @@ import os from typing import Sequence from amqpy import Message -from pyramid.paster import bootstrap +from pyramid.paster import get_appsettings from requests.exceptions import HTTPError, Timeout from sqlalchemy import cast, desc, func from sqlalchemy.dialects.postgresql import JSONB @@ -85,8 +85,8 @@ class TopicEmbedlyExtractor(PgsqlQueueConsumer): if __name__ == "__main__": # pylint: disable=invalid-name - env = bootstrap(os.environ["INI_FILE"]) - embedly_api_key = env["registry"].settings.get("api_keys.embedly") + settings = get_appsettings(os.environ["INI_FILE"]) + embedly_api_key = settings.get("api_keys.embedly") if not embedly_api_key: raise RuntimeError("No embedly API key available in INI file")