diff --git a/llama-index-core/llama_index/core/download/utils.py b/llama-index-core/llama_index/core/download/utils.py index e8dd91c284dad0d390548dccb89c91f83c35c470..1e9af5c076b26d5eb0ef02867e5115ce0fe9b7d6 100644 --- a/llama-index-core/llama_index/core/download/utils.py +++ b/llama-index-core/llama_index/core/download/utils.py @@ -90,7 +90,9 @@ def initialize_directory( def get_source_files_list(source_tree_url: str, path: str) -> List[str]: """Get the list of source files to download.""" - resp = requests.get(source_tree_url + path + "?recursive=1") + resp = requests.get( + source_tree_url + path + "?recursive=1", headers={"Accept": "application/json"} + ) payload = resp.json()["payload"] return [item["name"] for item in payload["tree"]["items"]] @@ -105,7 +107,7 @@ def recursive_tree_traverse( url = tree_urls[0] try: - res = requests.get(url) + res = requests.get(url, headers={"Accept": "application/json"}) tree_elements = res.json()["payload"]["tree"]["items"] except Exception: raise ValueError("Failed to traverse github tree source.") diff --git a/llama-index-legacy/llama_index/legacy/download/dataset.py b/llama-index-legacy/llama_index/legacy/download/dataset.py index bb5f22c21946527071e6be55b5296ecfcb3715ba..dac3fb10af0f7d8ba936d9e4c94d0e369d8b6fb6 100644 --- a/llama-index-legacy/llama_index/legacy/download/dataset.py +++ b/llama-index-legacy/llama_index/legacy/download/dataset.py @@ -47,7 +47,9 @@ def _resolve_dataset_file_name(class_name: str) -> str: def _get_source_files_list(source_tree_url: str, path: str) -> List[str]: """Get the list of source files to download.""" - resp = requests.get(source_tree_url + path + "?recursive=1") + resp = requests.get( + source_tree_url + path + "?recursive=1", headers={"Accept": "application/json"} + ) payload = resp.json()["payload"] return [item["name"] for item in payload["tree"]["items"]]