from pyodide.http import pyfetch import asyncio from pathlib import Path def createElementDiv(document, Element, name): element = document.createElement('div') element.id = name document.body.append(element) return Element(name) async def download(url): filename = Path(url).name response = await pyfetch(url, method="GET") if response.status == 200: status = response.status with open(filename, mode="wb") as file: file.write(await response.bytes()) data = open(filename, "rb").read() return data, status else: status = response.status return '', status