fixed errors
This commit is contained in:
@@ -10,6 +10,8 @@ import sys
|
||||
import os
|
||||
import requests
|
||||
|
||||
import helper_functions as hf
|
||||
|
||||
from newsapi import NewsApiClient
|
||||
from dotenv import load_dotenv
|
||||
|
||||
@@ -68,13 +70,14 @@ def format_article(article):
|
||||
Returns:
|
||||
String: formatted article
|
||||
"""
|
||||
sourcename = article["source"]["name"]
|
||||
headline = article["title"]
|
||||
url = article["url"]
|
||||
sourcename = hf.make_markdown_proof(article["source"]["name"]) # make attributes markdownv2 proof
|
||||
headline = hf.make_markdown_proof(article["title"])
|
||||
url = hf.make_markdown_proof(article["url"])
|
||||
formatted_article = f"_{sourcename}_\n*{headline}*\n\n{url}" # formatting in Markdown syntax
|
||||
|
||||
return formatted_article
|
||||
|
||||
|
||||
if __name__ == '__main__': # only execute if script is called directly -> for simple testing
|
||||
|
||||
print("this is a module and should not be run directly")
|
||||
|
Reference in New Issue
Block a user