aio-libs / aio-libs/aiohttp

Too many "async with"

未关闭
#5,385 21 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
16.5k
派生
2.4k
平均合并
17 小时 22 分钟
30 天内合并 PR
212

描述

🐣 **Is your feature request related to a problem? Please describe.**

I'm always frustrated when I use get or post method.
I must use "async with" to use get or post method.
So there's a lot of "async with" nesting.

💡 **Describe the solution you'd like**

I hope that I can use it just like httpx.
Ex:
```python
async def main():
async with httpx.AsyncClient() as session:
resposne = await session.get("http://httpbin.org") # I was able to release it without having to do it manually
print(resposne.text)
```

❓ **Describe alternatives you've considered**

![截图](https://user-images.githubusercontent.com/48802940/103777852-71bf8900-506c-11eb-8193-d415e79d167f.png)
Add "self.release" after "await self.read()".
Because I don't need connection after this.

📋 **Additional context**

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。