micropython-lib/micropython/uaiohttpclient/example.py

17 wiersze
291 B
Python
Czysty Zwykły widok Historia

2014-10-18 12:19:27 +00:00
#
# uaiohttpclient - fetch URL passed as command line argument.
#
import sys
2014-10-18 12:19:27 +00:00
import uasyncio as asyncio
import uaiohttpclient as aiohttp
async def run(url):
resp = await aiohttp.request("GET", url)
2014-10-18 12:19:27 +00:00
print(resp)
print(await resp.read())
2014-10-18 12:19:27 +00:00
2014-10-18 12:19:27 +00:00
url = sys.argv[1]
asyncio.run(run(url))