Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法使用HTTPDigestAuth创建会话?_Python_Authentication_Python Requests_Python Asyncio_Aiohttp - Fatal编程技术网

Python 无法使用HTTPDigestAuth创建会话?

Python 无法使用HTTPDigestAuth创建会话?,python,authentication,python-requests,python-asyncio,aiohttp,Python,Authentication,Python Requests,Python Asyncio,Aiohttp,我试图以异步方式发出GET请求。并用DigestAuth实现了客户端认证系统 async def run(self, url_list, api_auth): sem = asyncio.Semaphore(10) tasks = [] async with ClientSession(auth = HTTPDigestAuth("user_name", "password")) as session: fo

我试图以异步方式发出
GET
请求。并用DigestAuth实现了客户端认证系统

    async def run(self, url_list, api_auth):
    sem = asyncio.Semaphore(10)
    tasks = []
    async with ClientSession(auth = HTTPDigestAuth("user_name", "password")) as session:
        for url in url_list:
            task = asyncio.ensure_future(self.get_content(sem, url, session))
            tasks.append(task)
        response = await asyncio.gather(*tasks)
    logging.critical(f"Total size of response: {len(response)}")
TypeError:需要BasicAuth()元组

当我用
BasicAuth()
创建身份验证元组时

401
-未经授权


有没有合适的解决方法?

HTTPDigestAuth类来自哪里?从2017年开始,aiohttp似乎不支持摘要身份验证。
HTTPDigestAuth
类来自哪里?从2017年开始,aiohttp似乎不支持摘要身份验证。
async def run(self, url_list, api_auth):
    sem = asyncio.Semaphore(10)
    tasks = []
    async with ClientSession(auth = BasicAuth("user_name", "password", verify=True)) as session:
        for url in url_list:
            task = asyncio.ensure_future(self.get_content(sem, url, session))
            tasks.append(task)
        response = await asyncio.gather(*tasks)
    logging.critical(f"Total size of response: {len(response)}")