You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
auth doesn't seem to be used in Client.stream #1256
The bug is reproducible against the latest release: 0.14.3.
There are no similar issues or pull requests to fix it yet: that I could find....
Describe the bug
Client.stream seems to not use auth as provided in the initializer of Client objects.
To reproduce
Create an httpx.Client object with auth set.
cli = httpx.Client(auth=("user", "password"))
Check that the client.get/post works ok.
url = "<url to smallish file>"
resp = cli.get(url)
resp.raise_for_status() # no error is raised
Then try Client.stream normally.
with cli.stream("GET", url) as resp:
resp.raise_for_status() # HTTPStatusError 401 is raised
....
Try Client.stream with auth.
with cli.stream("GET", url, auth=cli.auth) as resp:
resp.raise_for_status() # no error is raised
....
Expected behavior
auth is used by method Client.stream.
Actual behavior
auth is not used by method Client.stream.
Environment
OS:
Python version
HTTPX version:
Python 3.7.7 (default, May 16 2020, 11:38:23)
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import httpx
>>> httpx.__version__
'0.14.3'
>>>
With version 0.15.0, I can reproduce the issue. On one of our packages using both the stream function and authentication, we had to make a fix to pass the authentication to the client.stream method directly rather than to the httpx.Client.
Activity
florimondmanca commentedon Sep 4, 2020
Hmm — not able to reproduce…
Does the above^ reproduce the issue on your side? If not, what is the host you're requesting exactly? Could be a faulty server implementation… 🤔
enguerranchevalier commentedon Sep 23, 2020
Hello @florimondmanca / @tomchristie,
With version 0.15.0, I can reproduce the issue. On one of our packages using both the stream function and authentication, we had to make a fix to pass the authentication to the
client.streammethod directly rather than to thehttpx.Client.Screenshot:
lovelydinosaur commentedon Sep 23, 2020
Confirmed in #1312