Skip to content

Commit

Permalink
Add timeout to the image request using httpx (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi03071991 authored Sep 4, 2024
1 parent f13a1a2 commit f304c2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion llama_parse/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ def get_images(self, json_result: List[dict], download_path: str) -> List[dict]:
image["page_number"] = page["page"]
with open(image_path, "wb") as f:
image_url = f"{self.base_url}/api/parsing/job/{job_id}/result/image/{image_name}"
f.write(httpx.get(image_url, headers=headers).content)
f.write(
httpx.get(
image_url, headers=headers, timeout=self.max_timeout
).content
)
images.append(image)
return images
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "llama-parse"
version = "0.5.1"
version = "0.5.2"
description = "Parse files into RAG-Optimized formats."
authors = ["Logan Markewich <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit f304c2d

Please sign in to comment.