import requests


def live_data(key):
    """
    Requests latest covid-19 stats from rapidapi using requests.


    Parameters
    ----------
    key: rapidapi key


    Returns
    -------
    response: A dictionary containing data in json format.
    """
    # https://rapidapi.com/astsiatsko/api/coronavirus-monitor
    url = "https://coronavirus-monitor.p.rapidapi.com/coronavirus/cases_by_country.php"

    headers = {
        'x-rapidapi-host': "coronavirus-monitor.p.rapidapi.com",
        'x-rapidapi-key': key
        }

    response = requests.request("GET", url, headers=headers)
    return response