Skip to content

[ISSUE] Proxy configuration with httpx v0.28+ #498

@egreenspan2

Description

@egreenspan2

Description
Configure proxy with SDK fails when httpx version is >=0.28

Reproduction

    config = Config(
        proxy=Proxy(host="abc.domain.com", port=80),
    )

    session = zssdk.Session(config=config)

    for user in session.zia.admin_users.all():
        print(user.name)

Get Exception:

  File "/xxx/.venv/lib/python3.12/site-packages/zssdk/zscore/httpsession.py", line 90, in __init__
    self._client = httpx.Client(**client_kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

Expected behavior
Should get the list of admin users from zia

Is it a regression?
Did not test other versions, should work fine with older version of httpx
httpx release notes

Other Information

  • OS: Ubuntu
  • Version: Ubuntu 24.04.4 LTS

Additional context
The Fix to the issue is as follows on httpsession.py line 88

        # Setup proxy configuration from pre-resolved proxy_config
        if proxy_config:
            proxy_url = self._setup_proxy(proxy_config)
            if proxy_url:
                # client_kwargs["proxies"] = {"http": proxy_url, "https": proxy_url}
                # fix the httpx v0.28+
                client_kwargs["proxy"] = proxy_url

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions