master.Get error TypeError: get() got an unexpected keyword argument 'verify' when I try to disable ssl validation for a client.get call.
Our environment uses proxy servers and local ssl certs, so I'd just like to disable ssl validation entirely.
async with httpx.AsyncClient() as client:
r = await client.get(
"https://someserver", verify=False
)
Returns back
...
File "C:\code\gits\project.py", line 158, in get_support_matrix
"https://someserver", verify=False
TypeError: get() got an unexpected keyword argument 'verify'
verify=False to function as documented at https://www.python-httpx.org/advanced/
Or you can also disable the SSL verification entirely, which is not recommended.
import httpx
r = httpx.get("https://example.org", verify=False)
TypeError: get() got an unexpected keyword argument 'verify'
Complete test case for python 3.6:
import httpx
import asyncio
async def testfun():
async with httpx.AsyncClient() as client:
r = await client.get('https://www.example.org/', verify=False)
print(r)
loop = asyncio.get_event_loop()
loop.run_until_complete(testfun())
loop.close()
Hi there,
Not a bug I believe, verify is to be passed at the client level: AsyncClient(verify=...). (If the docs say otherwise then that should be fixed.)
There was a decision to remove it from request methods, due to too low complexity vs value ratio. If you need to disable SSL verification on a specific request you can use a throwaway client. I think there are past issues related to this where you鈥檇 find more background, but I鈥檓 not able to dig back right now. :-)
Cheers!
Update: here is the relevant docs section which states the same than what I鈥檝e shared here: https://www.python-httpx.org/advanced/#ssl-configuration-on-client-instances