Files
RustPython/wasm/demo/snippets/fetch.py
2019-02-26 20:28:25 -06:00

13 lines
285 B
Python

from browser import fetch
def fetch_handler(res):
print(f"headers: {res['headers']}")
fetch(
"https://httpbin.org/get",
response_format="json",
headers={
"X-Header-Thing": "rustpython is neat!"
},
).then(fetch_handler, lambda err: print(f"error: {err}"))