Browse Source

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).
merge-requests/64/head
Deimos 6 years ago
parent
commit
39665058d2
  1. 6
      tildes/consumers/topic_embedly_extractor.py

6
tildes/consumers/topic_embedly_extractor.py

@ -8,7 +8,7 @@ import os
from typing import Sequence from typing import Sequence
from amqpy import Message from amqpy import Message
from pyramid.paster import bootstrap
from pyramid.paster import get_appsettings
from requests.exceptions import HTTPError, Timeout from requests.exceptions import HTTPError, Timeout
from sqlalchemy import cast, desc, func from sqlalchemy import cast, desc, func
from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.dialects.postgresql import JSONB
@ -85,8 +85,8 @@ class TopicEmbedlyExtractor(PgsqlQueueConsumer):
if __name__ == "__main__": if __name__ == "__main__":
# pylint: disable=invalid-name # 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: if not embedly_api_key:
raise RuntimeError("No embedly API key available in INI file") raise RuntimeError("No embedly API key available in INI file")

Loading…
Cancel
Save