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)}")