aio-libs / aio-libs/aiohttp

Redirect not been followed

Đang mở
#2,502 16 bình luận 0 reaction 0 người được giao Xem trên GitHub
client 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

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))
```

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.