aio-libs / aio-libs/aiohttp

ClientSession cookies does not work with IP

Aperta
#1,183 16 commenti 4 reazioni 0 assegnatari Vedi su GitHub
enhancement need pull request
Lingua principale
Python
Stelle
16.5k
Fork
2.4k
Merge medio
17h 22m
PR unite (30g)
212

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.