aio-libs / aio-libs/aiohttp

Too many "async with"

Đang mở
#5,385 21 bình luận 1 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
16.5k
Fork
2.4k
Merge trung bình
17 giờ 22 phút
Pull request đã merge (30 ngày)
212

Mô tả

🐣 **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**

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.