Skip to content

async request with verify_ssl=False does not work #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fsvenson opened this issue Oct 12, 2021 · 2 comments · Fixed by #533
Closed

async request with verify_ssl=False does not work #510

fsvenson opened this issue Oct 12, 2021 · 2 comments · Fixed by #533
Labels
🐞bug Something isn't working
Milestone

Comments

@fsvenson
Copy link

Describe the bug
The async httpx request methods do not expect the keyword argument verify. It shall be passed to the client, not the request method.

Traceback (most recent call last):
  File "test.py", line 47, in <module>
    loop.run_until_complete(main())
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "test.py", line 21, in main
    resp = await post_auth_login.asyncio(json_body=body, client=client)
  File "/dev/shm/env/lib64/python3.6/site-packages/construct_api_client/api/auth/post_auth_login.py", line 106, in asyncio
    json_body=json_body,
  File "/dev/shm/env/lib64/python3.6/site-packages/construct_api_client/api/auth/post_auth_login.py", line 91, in asyncio_detailed
    response = await _client.post(**kwargs)
TypeError: post() got an unexpected keyword argument 'verify'

To Reproduce
Call any asyncio() method with the client option verify_ssl=False.

Expected behavior
The call should pass without a TypeError..

Desktop (please complete the following information):

  • OS: CentOS 7.6
  • Python Version: 3.6.8
  • openapi-python-client version: 0.10.5
@fsvenson fsvenson added the 🐞bug Something isn't working label Oct 12, 2021
@dbanty dbanty added this to the 0.10.6 milestone Oct 12, 2021
@dbanty
Copy link
Collaborator

dbanty commented Oct 12, 2021

Thanks for reporting! I'm going to do a sweep of PRs and bugs this weekend so I'll try and get this one in too.

@mvaught02
Copy link

looking at https://www.python-httpx.org/advanced/#ssl-configuration-on-client-instances

I found the fix for this in my case was to remove "verify": client.verify_ssl from the _get_kwargs function and pass it directly to the client setup instead eg...

    async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
        response = await _client.get(**kwargs)

as well for the case of synchronous clients

response = httpx.get(verify=client.verify_ssl, **kwargs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
3 participants