aio-libs / aio-libs/aiohttp

Redirect not been followed

Aperta
#2,502 16 commenti 0 reazioni 0 assegnatari Vedi su GitHub
client 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

Redirect not been followed. I always get a `302` back.

## Expected behaviour

Get a `200` back with text filled.

## Steps to reproduce

```python
import aiohttp
import asyncio

async def fetch(session, url):
async with session.get(url, allow_redirects=True) as response:
return await response.text(), response.status

async def fetch_all(session, urls, loop):
results = await asyncio.gather(
*[fetch(session, url) for url in urls],
)

for ret in results:
print("status: %s len: %s" % (ret[1], len(ret[0])))
return results

if __name__ == '__main__':
loop = asyncio.get_event_loop()
urls = ['https://www.gulp.de/gulp2/projekte/suche?scope=projects&query=python']
with aiohttp.ClientSession(loop=loop) as session:
loop.run_until_complete(fetch_all(session, urls, loop))
```

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.