response.status始终返回401。 有什么问题? 通过浏览器认证成功
import asyncio
import aiohttp
async def f():
async with aiohttp.request('GET', "http://{}/".format("10.80.7.192"), auth=aiohttp.BasicAuth('root','root') ) as response:
return response.status
ioloop = asyncio.get_event_loop()
tasks = [ioloop.create_task(f())]
wait_tasks = asyncio.wait(tasks)
done, set = ioloop.run_until_complete(wait_tasks)
for future in done:
value = future.result()
print(value)
ioloop.close()