From 19ecc5631601bc9e9ae58e7c73356a3117fff5f6 Mon Sep 17 00:00:00 2001 From: gwen Date: Wed, 16 Oct 2024 13:24:14 +0200 Subject: [PATCH] replace httpx with the requests stdlib --- docs/ext/extinclude.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/ext/extinclude.py b/docs/ext/extinclude.py index 1daa770c3..19218d4dc 100644 --- a/docs/ext/extinclude.py +++ b/docs/ext/extinclude.py @@ -7,7 +7,7 @@ from sphinx.util.docutils import SphinxDirective, SphinxRole from sphinx.util.typing import ExtensionMetadata from sphinx.directives.code import LiteralInclude, container_wrapper -from httpx import get +import requests class ExtInclude(LiteralInclude): """A directive to include code that comes from an url @@ -29,9 +29,13 @@ class ExtInclude(LiteralInclude): def run(self) -> list[nodes.Node]: url = self.arguments[0] - content = get(url) + headers = { + 'accept': 'application/text', + 'Content-Type': 'application/text', + } + response = requests.get(url, headers=headers) #paragraph_node = nodes.paragraph(text=f'hello {self.arguments[0]}!') - code = content.text + code = response.text literal = nodes.literal_block(code, code) if 'language' in self.options: