"API endpoint does not exist."

Hi! I'm tryin to get a dataframe from a query on Metabase. This is my code:

def get_metabase_data(query_ids, username, password, url):
    session = requests.Session()
    login_data = {"username": username, "password": password}
    session.post(f"https://{url}/api/session", json=login_data)
    dfs = []
    if isinstance(query_ids, int):
        query_url = f"{url}/api/card/{query_ids}/query/json"
        response = session.get(query_url)
        print(response.text)
        if response.status_code == 200:
            df = pd.DataFrame(response.json())
            return df
    elif isinstance(query_ids, list):
        for query_id in query_ids:
            query_url = f"https://{url}/api/card/{query_id}/query/json"
            response = session.get(query_url)
            print(response.text)
            if response.status_code == 200:
                df = pd.DataFrame(response.json())
                dfs.append(df)
        final_df = pd.concat(dfs, axis=0)
        return final_df
    else:
        raise TypeError("The query_ids argument must be an integer or a list of integers")

query_ids = 1111 #example
username = username
password = password
url = "url_example"  #example

print(get_metabase_data(query_ids, username, password, url))

But I keep receiving the error "API endpoint does not exist." on response print! And the output is None. I cant find the reason... By the way, while trying manual query, I see the data I need.

Can someone help me?

Can you put a couple of prints in the code and share the output please ... so we can confirm the query_url and other variables you have setup