add debug env variable

This commit is contained in:
2022-04-25 13:30:06 -04:00
parent e24a3f2ea2
commit 594d85c7fb

View File

@@ -19,6 +19,7 @@ bot_token = os.environ.get("TG_BOT_TOKEN")
country = os.environ.get("STREAMING_COUNTRY") or "us"
filter_user = os.environ.get("TG_BOT_USER")
logging_debug = os.environ.get("TG_DEBUG")
tmdb_url = "https://api.themoviedb.org/3"
tmdb_headers = {
@@ -33,10 +34,17 @@ sa_headers = {
'x-rapidapi-key': sa_api_token
}
updater = Updater(token=bot_token, use_context=True)
dispatcher = updater.dispatcher
logging.basicConfig(
if logging_debug:
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.DEBUG)
else:
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
@@ -119,6 +127,7 @@ def movie_lookup(movie, user_firstname):
if not services or sa_response == "404":
tg_reply = tg_reply + "\n\nStreaming not available :\("
logger.info(f'{user_firstname}: No streaming available for "{movie_title}: ({movie_year})"')
else:
for s in services:
leaving_epoch = sa_response["streamingInfo"][s]["us"]["leaving"]