moved news_fetcher to new dir
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -2,4 +2,5 @@ | ||||
| .env | ||||
| env | ||||
| __pycache__/* | ||||
| telegram_bot/__pycache__/* | ||||
| telegram_bot/__pycache__/* | ||||
| telegram_bot/news/__pycache__/* | ||||
| @@ -21,7 +21,7 @@ import time | ||||
| import sys | ||||
| import logging | ||||
|  | ||||
| import news_fetcher | ||||
| import news.news_fetcher as news | ||||
|  | ||||
| from telebot import types | ||||
| from dotenv import load_dotenv | ||||
| @@ -92,9 +92,9 @@ def send_news(message): | ||||
|     user_id = int(message.from_user.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: | ||||
|         formatted_article = news_fetcher.format_article(articles["articles"][0]) | ||||
|         formatted_article = news.format_article(articles["articles"][0]) | ||||
|     except IndexError: | ||||
|         bot.send_message(chat_id=user_id, text=f"no news currently available for keyword: {keyword}") | ||||
|         return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user