Skip to content

Commit 9f885bf

Browse files
committed
Add text/markdown to Accept header
1 parent c83de14 commit 9f885bf

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/markitdown/src/markitdown/_markitdown.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ def __init__(
107107
requests_session = kwargs.get("requests_session")
108108
if requests_session is None:
109109
self._requests_session = requests.Session()
110+
# Signal that we prefer markdown over HTML, etc. if the server supports it.
111+
# e.g., https://blog.cloudflare.com/markdown-for-agents/
112+
self._requests_session.headers.update(
113+
{
114+
"Accept": "text/markdown, text/html;q=0.9, text/plain;q=0.8, */*;q=0.1"
115+
}
116+
)
110117
else:
111118
self._requests_session = requests_session
112119

0 commit comments

Comments
 (0)