Skip to content

Commit

Permalink
fis: logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowtham1729 committed Dec 10, 2023
1 parent d32d27e commit 447bc9d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions applications/data_fetcher/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ def to_news(self, items: Dict, tickers_list: List[str]) -> List[News]:
return news

def fetch_news(self):
logging.log(f"Fetching Tickers...")
logging.info(f"Fetching Tickers...")
tickers = self.get_tickers()
tickers_list = [ticker.ticker for ticker in tickers]
logging.log(f"Ticker List: {tickers_list}")
logging.info(f"Ticker List: {tickers_list}")

ticker_symbols = ",".join(tickers_list)
today_date = datetime.today().strftime("%Y-%m-%d")
page = 1
news_url = f"{self.marketaux_news_url}&symbols={ticker_symbols}&published_on={today_date}"

logging.log(f"Fetching News...")
logging.info(f"Fetching News...")
response = requests.get(f"{news_url}&page={page}")
news = []
if response.status_code == 200:
Expand All @@ -127,12 +127,11 @@ def fetch_news(self):
news += self.to_news(response_json["data"], tickers_list)
else:
break
logging.log(f"Finished fetching News: {news}")
logging.log(f"Inserting News...")
logging.info(f"Finished fetching News: {news}")
logging.info(f"Inserting News...")
self.insert_news(news)


if __name__ == "__main__":
fetcher = Fetcher()
print("Hello")
fetcher.fetch_news()

0 comments on commit 447bc9d

Please sign in to comment.