Python aiohttp请求返回401

时间:2020-04-30 11:04:57

标签: python authentication aiohttp

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

0 个答案:

没有答案