Handle predbs being down.
This commit is contained in:
parent
673e69802c
commit
6ec7c2a377
|
@ -44,6 +44,7 @@ class DailyReleasesBot(object):
|
|||
|
||||
def run(self):
|
||||
mode = self.config["main"]["mode"]
|
||||
logger.info("Mode is %s", mode)
|
||||
|
||||
if mode == "test":
|
||||
self.generate(post=False)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -13,7 +14,15 @@ class Predb(object):
|
|||
def get_releases(self):
|
||||
logger.info("Getting releases from predbs")
|
||||
|
||||
return {**self._get_predbme(), **self._get_srrdb(), **self._get_xrel()} # in reverse order of preference
|
||||
releases = {}
|
||||
for db_releases in (self._get_predbme, self._get_srrdb, self._get_xrel): # in reverse order of preference
|
||||
try:
|
||||
releases.update(db_releases())
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
logger.error(e)
|
||||
logger.warning("Connection to predb failed, skipping..")
|
||||
|
||||
return releases
|
||||
|
||||
def _get_xrel(self, categories=("CRACKED", "UPDATE"), num_pages=2):
|
||||
logger.debug("Getting releases from xrel.to")
|
||||
|
|
Reference in a new issue