From 7386e1d8b08388e363b860a1d3251d8b58c53fd5 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 5 Mar 2022 22:04:25 +0000 Subject: [PATCH] Include option to disable readerserver --- apiserver/feed.py | 6 +++++- apiserver/settings.py.example | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apiserver/feed.py b/apiserver/feed.py index 554485d..327f133 100644 --- a/apiserver/feed.py +++ b/apiserver/feed.py @@ -54,8 +54,12 @@ def get_article(url): logging.info('Trying our server instead...') + if not settings.READER_URL: + logging.info('Readerserver not configured, aborting.') + return '' + try: - r = requests.post(READ_API, data=dict(url=url), timeout=20) + r = requests.post(settings.READER_URL, data=dict(url=url), timeout=20) if r.status_code != 200: raise Exception('Bad response code ' + str(r.status_code)) return r.text diff --git a/apiserver/settings.py.example b/apiserver/settings.py.example index 3064e5d..391d751 100644 --- a/apiserver/settings.py.example +++ b/apiserver/settings.py.example @@ -14,6 +14,10 @@ NUM_TILDES = 5 #MEILI_URL = 'http://127.0.0.1:7700/' MEILI_URL = '' +# Readerserver URL +# Leave blank if not using, but that defeats the whole point +READER_URL = 'http://127.0.0.1:33843/' + # Reddit account info # leave blank if not using Reddit REDDIT_CLIENT_ID = ''