def request(url: str, method: str = "get", timeout: int = 10, **kwargs):
    """Helper to make requests from a url."""
    method = method.lower()
    assert method in [
        "delete",
        "get",
        "head",
        "patch",
        "post",
        "put",
    ], "Invalid request method."

    headers = kwargs.pop("headers", {})
    func = getattr(requests, method)
    return func(url, headers=headers, timeout=timeout, **kwargs)
Helper to make requests from a url.
llama-index-integrations/tools/llama-index-tools-finance/llama_index/tools/finance/util.py