import logging
import requests


def news_API_request(covid_terms: str = "Covid COVID-19 coronavirus"):
    """
    This function get the news from the news API according to the given keywords.

    :arg
        covid_terms (str): Keywords of the news that you want to get

    :return:
        Json file: A json file containing the news that you get

    """
    logging.info("getting the news with the keywords: " + covid_terms)
    base_url = "https://newsapi.org/v2/everything?"
    api_key = "f59ef4d22d7540f39636e99e44b9d0e6"
    keywords = "Covid&COVID-19&coronavirus&"
    language = "en&"
    sort = "publishedAt&"
    full_url = base_url + "qInTitle=" + keywords + "sortBy=" + sort + "language=" + language + "apiKey=" + api_key
    r = requests.get(full_url)
    return r.json()