参照aiohttp 官网的教程,写了个示例,发现语法报错。
import asyncio
import aiohttp
async with aiohttp.ClientSession() as session:
async with session.get('https://api.github.com/events') as resp:
print(resp.status)
print(await resp.text())
-------------
File "/Users/zed/PycharmProjects/example/used_aiohttp/1.py", line 3
async with aiohttp.ClientSession() as session:
^
SyntaxError: invalid syntax
现在是不支持这样的写法了吗
async with xxxxx as xxxx:
pass