aio-libs / aio-libs/aiohttp

ClientSession cookies does not work with IP

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

描述

## 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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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