# Use ‹aiohttp› (‹python -mpip install aiohttp›) to fetch a given # URL and stream the HTML into ‹tidy› (‹html-tidy.org›). # Specifically, use ‹tidy 2>&1› as the command that you start with # ‹asyncio.create_subprocess_shell›. Capture the ‹stdout› and return # the output until the first blank line, as a list of ‹bytes› # objects. import aiohttp import asyncio from asyncio.subprocess import PIPE async def tidy( url ): pass def test_main() -> None: async def main() -> None: out = await tidy( 'http://example.com' ) assert b'Tidy found 1 warning and 0 errors!\n' in out, out assert len(out) <= 5 asyncio.run( main() ) if __name__ == '__main__': test_main()