Remove pyxhr imports from http/__init__.py (#5953)

And rename _pyxhr.py to pyxhr.py.
This commit is contained in:
Hood Chatham
2025-10-17 18:44:24 -07:00
committed by GitHub
parent 94c289ec38
commit f1de0a1a33
3 changed files with 15 additions and 10 deletions

View File

@@ -64,7 +64,7 @@ def set_configs():
pyodide._api.pyodide_ffi.register_js_module;
pyodide._api.pyodide_ffi.unregister_js_module;
pyodide.pyimport("pyodide.ffi.wrappers").destroy();
pyodide.pyimport("pyodide.http").destroy();
pyodide.pyimport("pyodide.http.pyxhr").destroy();
pyodide.pyimport("pyodide_js._api");
""")

View File

@@ -2,16 +2,12 @@ from io import StringIO
# Keep open_url in __init__ for now, will be moved to pyxhr.py later
from ..ffi import IN_BROWSER
from . import _pyxhr as pyxhr
from ._exceptions import (
AbortError,
BodyUsedError,
HttpStatusError,
XHRError,
XHRNetworkError,
)
from ._pyfetch import FetchResponse, pyfetch
from ._pyxhr import XHRRequestParams, XHRResponse
if IN_BROWSER:
try:
@@ -26,11 +22,6 @@ __all__ = [
"HttpStatusError",
"BodyUsedError",
"AbortError",
"pyxhr",
"XHRResponse",
"XHRRequestParams",
"XHRError",
"XHRNetworkError",
]

View File

@@ -32,6 +32,20 @@ if IN_BROWSER:
except ImportError:
pass
__all__ = [
"delete",
"get",
"head",
"options",
"patch",
"post",
"put",
"XHRError",
"XHRNetworkError",
"XHRRequestParams",
"XHRResponse",
]
class XHRRequestParams(TypedDict):
"""Parameters for XMLHttpRequest operations."""