Skip to content

Include httpx2 in examples instead of deprecated httpx - #122

Merged
sim0nx merged 1 commit into
python-rt:masterfrom
nazywam:bugfix/httpx-migration
Jul 22, 2026
Merged

Include httpx2 in examples instead of deprecated httpx#122
sim0nx merged 1 commit into
python-rt:masterfrom
nazywam:bugfix/httpx-migration

Conversation

@nazywam

@nazywam nazywam commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

I've noticed that some of my integrations stopped working after upgrading to the latest python-rt version.

It seems that migrating from httpx to httpx2 has some breaking changes if we pass authorization using the BasicAuth object:

uv run python3 -c "import httpx; import rt.rest2; rt.rest2.AsyncRt('http://localhost/rt/REST/2.0/', http_auth=httpx.BasicAuth('root', 'password'))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/rt/.venv/lib/python3.10/site-packages/rt/rest2.py", line 1843, in __init__
    self.session = httpx2.AsyncClient(timeout=http_timeout, verify=ssl_verify, proxy=proxy, auth=http_auth)
  File "/tmp/rt/.venv/lib/python3.10/site-packages/httpx2/_client.py", line 1335, in __init__
    super().__init__(
  File "/tmp/rt/.venv/lib/python3.10/site-packages/httpx2/_client.py", line 198, in __init__
    self._auth = self._build_auth(auth)
  File "/tmp/rt/.venv/lib/python3.10/site-packages/httpx2/_client.py", line 434, in _build_auth
    raise TypeError(f'Invalid "auth" argument: {auth!r}')
TypeError: Invalid "auth" argument: <httpx.BasicAuth object at 0x7ae1f91251b0>

The least we can do is to update the current documentation so that it works on current master.

@sim0nx

sim0nx commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Nice catch, thank's a lot @nazywam !

@sim0nx
sim0nx merged commit 506563e into python-rt:master Jul 22, 2026
7 checks passed
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.37%. Comparing base (7cd93a9) to head (98d402e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #122   +/-   ##
=======================================
  Coverage   85.37%   85.37%           
=======================================
  Files          11       11           
  Lines        2161     2161           
=======================================
  Hits         1845     1845           
  Misses        316      316           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nazywam
nazywam deleted the bugfix/httpx-migration branch July 23, 2026 09:30
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 this pull request may close these issues.

2 participants