Httpx: verify argument seem unsupported by async client

Created on 18 Jun 2020  路  2Comments  路  Source: encode/httpx

Checklist

  • [x] The bug is reproducible against the latest release and/or master.
  • [x] There are no similar issues or pull requests to fix it yet.

Describe the bug

Get error TypeError: get() got an unexpected keyword argument 'verify' when I try to disable ssl validation for a client.get call.

To reproduce

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'

Expected behavior

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)

Actual behavior

TypeError: get() got an unexpected keyword argument 'verify'

Debugging material

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

Environment

  • OS: Windows
  • Python version: Python 3.6.2
  • HTTPX version: Version: 0.13.3
  • Async environment: asyncio
  • HTTP proxy: yes
  • Custom certificates: yes

Additional context

question

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulchubatyy picture paulchubatyy  路  4Comments

FlorianREGAZ picture FlorianREGAZ  路  4Comments

edocod1 picture edocod1  路  3Comments

tomchristie picture tomchristie  路  3Comments

florimondmanca picture florimondmanca  路  3Comments