Skip to content

Fix: Add Timeout Parameter to HTTP Requests in MarkItDown Class#1412

Open
sammydeprez wants to merge 1 commit into
microsoft:mainfrom
sammydeprez:main
Open

Fix: Add Timeout Parameter to HTTP Requests in MarkItDown Class#1412
sammydeprez wants to merge 1 commit into
microsoft:mainfrom
sammydeprez:main

Conversation

@sammydeprez

Copy link
Copy Markdown

This pull request addresses Issue #1167, where HTTP/HTTPS requests could hang indefinitely if the server fails to close the stream. To prevent this, a timeout parameter has been added to the requests.get() call within the convert_uri method.

🔧 Change Summary
Before:

response = self._requests_session.get(uri, stream=True)

After:

response = self._requests_session.get(uri, stream=True, timeout=kwargs.get("timeout", None))

This change allows users to optionally specify a timeout via kwargs, ensuring better control over request behavior and avoiding indefinite hangs.

✅ Benefits

  • Prevents hanging on unresponsive servers
  • Enables customizable timeout handling
  • Backward-compatible: defaults to None if not provided

@jerpint

jerpint commented Oct 16, 2025

Copy link
Copy Markdown

any updates on merging this?

@sammydeprez

Copy link
Copy Markdown
Author

There are so many needed PRs open, no one that is merging them 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants