aio-libs / aio-libs/aiohttp

ClientSession cookies does not work with IP

Đang mở
#1,183 16 bình luận 4 reaction 0 người được giao Xem trên GitHub
enhancement need pull request
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ả

## Long story short

I use `127.0.0.1` instead of `localhost` for development and wasted few hours before understand why my tests breaks :)

```
import asyncio
import aiohttp

async def main():
urls = [
'http://httpbin.org/cookies/set?test=ok',
'http://54.175.219.8/cookies/set?test=ok',
]
for url in urls:
with aiohttp.ClientSession() as s:
async with s.get(url) as r:
print(await r.json())
print(list(s.cookie_jar))

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```
## Actual behaviour

```
{'cookies': {'test': 'ok'}}
[]
{'cookies': {}}
[]
```
## Your environment

Last stable release of aiohttp, linux

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.