Skip to content
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

httpx proxy parameter #623

Open
virgiled-eviden opened this issue Dec 6, 2024 · 2 comments
Open

httpx proxy parameter #623

virgiled-eviden opened this issue Dec 6, 2024 · 2 comments

Comments

@virgiled-eviden
Copy link

Hello @marcospereirampj , very nice library you created here.
I encountered a problem while using it through codespace on github:

python-keycloak version is 4.7.1

Traceback (most recent call last):

File "/workspaces/sonar-migration/populate_keycloak.py", line 190, in <module>
  main()
File "/workspaces/sonar-migration/populate_keycloak.py", line 142, in main
  kc_handler = configure()
File "/workspaces/sonar-migration/populate_keycloak.py", line 51, in configure
  keycloak_connection = KeycloakOpenIDConnection(
File "/workspaces/sonar-migration/.venv/lib/python3.10/site-packages/keycloak/openid_connection.py", line 141, in __init__
  super().__init__(
File "/workspaces/sonar-migration/.venv/lib/python3.10/site-packages/keycloak/connection.py", line 105, in __init__
  self.async_s = httpx.AsyncClient(verify=verify, proxies=proxies, cert=cert)

TypeError: AsyncClient.init() got an unexpected keyword argument 'proxies'

I suppose that in codespace there are some HTTP(S)_PROXY env vars set that httpx respects, I must admint I'm a bit confused by the fact that it works on my machine...

Anyway, the fact is that httpx.AsyncClient has no "proxies" argument, only a "proxy" one (cf AsyncClient in https://www.python-httpx.org/api/)
Don't know if that changed recently, Im surprised that it was not noticed before.

Any thoughts?

@Thodorissio
Copy link

Hello I had the same issue so I downgraded the python-keycloak to 4.0.0 to make my app work. (I didnt test for higher versions - they might work as well)

@ryshoooo
Copy link
Collaborator

ryshoooo commented Dec 6, 2024

Hi @virgiled-eviden

This has been fixed with https://github.com/marcospereirampj/python-keycloak/pull/622/files and released in version 4.7.3, thus upgrading the version of python-keycloak should do the trick. The reason it works for you is likely due to the older version of httpx library, where proxies argument was supported, however in the latest versions it is not.

@ryshoooo ryshoooo linked a pull request Dec 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants