Is Brython is planned to use Fetch API ? #2425
-
Hi, According to https://developer.mozilla.org/en-US/docs/Glossary/XMLHttpRequest
ok, right... There is no explanation why.. I beleive the Brython But would there be an advantage to use the Thanks :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can use from browser import window, aio
async def fetch(url):
resp = await window.fetch(url)
print(await resp.text())
aio.run(fetch('test.html')) |
Beta Was this translation helpful? Give feedback.
-
It is documented like for other web technologies on the MDN site. I don't think it was designed for performance, but (quoting the MDN site) as a "a more powerful and flexible replacement for XMLHttpRequest.". |
Beta Was this translation helpful? Give feedback.
You can use
fetch()
like any other function in the global Javascript namespace: