moved news_fetcher to new dir
This commit is contained in:
parent
d3a99997b8
commit
af01a7e183
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
env
|
env
|
||||||
__pycache__/*
|
__pycache__/*
|
||||||
telegram_bot/__pycache__/*
|
telegram_bot/__pycache__/*
|
||||||
|
telegram_bot/news/__pycache__/*
|
@ -21,7 +21,7 @@ import time
|
|||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import news_fetcher
|
import news.news_fetcher as news
|
||||||
|
|
||||||
from telebot import types
|
from telebot import types
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
@ -92,9 +92,9 @@ def send_news(message):
|
|||||||
user_id = int(message.from_user.id)
|
user_id = int(message.from_user.id)
|
||||||
#Get Information for user with this id
|
#Get Information for user with this id
|
||||||
|
|
||||||
articles = news_fetcher.get_top_news_by_keyword(keyword) #tbd: get keyword from db
|
articles = news.get_top_news_by_keyword(keyword) #tbd: get keyword from db
|
||||||
try:
|
try:
|
||||||
formatted_article = news_fetcher.format_article(articles["articles"][0])
|
formatted_article = news.format_article(articles["articles"][0])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
bot.send_message(chat_id=user_id, text=f"no news currently available for keyword: {keyword}")
|
bot.send_message(chat_id=user_id, text=f"no news currently available for keyword: {keyword}")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user