Skip to content

Incompatible with httpcore 0.12.0 #1499

Closed

Description

@UrbiJr

Describe the bug

I get TypeError: __init__() got an unexpected keyword argument 'retries' after latest update when trying to create an instance through httpx.Client().

Traceback:

>>> client = httpx.Client()
Exception ignored in: <function Client.__del__ at 0x0000029540F5C948>
Traceback (most recent call last):
  File "C:\Users\UrbiJ\AppData\Local\Programs\Python\Python37\lib\site-packages\httpx\_client.py", line 1130, in __del__
    self.close()
  File "C:\Users\UrbiJ\AppData\Local\Programs\Python\Python37\lib\site-packages\httpx\_client.py", line 1102, in close
    self._transport.close()
AttributeError: 'Client' object has no attribute '_transport'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\UrbiJ\AppData\Local\Programs\Python\Python37\lib\site-packages\httpx\_client.py", line 608, in __init__
    trust_env=trust_env,
  File "C:\Users\UrbiJ\AppData\Local\Programs\Python\Python37\lib\site-packages\httpx\_client.py", line 649, in _init_transport
    verify=verify, cert=cert, http2=http2, limits=limits, trust_env=trust_env
  File "C:\Users\UrbiJ\AppData\Local\Programs\Python\Python37\lib\site-packages\httpx\_transports\default.py", line 67, in __init__
    backend=backend,
TypeError: __init__() got an unexpected keyword argument 'retries'

To reproduce

>>> import httpx
>>> s = httpx.Client()

Environment

  • OS: Windows
  • Python version: 3.7.9
  • HTTPX version: 0.17.0

Activity

  1. johtso commented on Mar 5, 2021

    @johtso
    Contributor

    What's your httpcore version?

    I'm guessing that somehow you updated httpx without the httpcore dependency being updated.

    The retries argument was added to httpcore in version 0.12.1, and httpx enforces httpcore >= 0.12.1

  2. UrbiJr commented on Mar 5, 2021

    @UrbiJr
    Author

    yeah indeed that was the problem ! thank you

  3. johtso commented on Mar 5, 2021

    @johtso
    Contributor

    One of the downsides of the separate libraries approach. Out of curiosity, how did you manage to update httpx without the dependency updating?

  4. UrbiJr commented on Mar 5, 2021

    @UrbiJr
    Author

    Tbh, I'm Not sure if I updated httpx without the dependency being updated, or if I accidentally installed a previous version of httpcore later... It could also be second option, in that case I must have forgotten to activate the venv of some projects

  5. johtso commented on Mar 5, 2021

    @johtso
    Contributor

    Ah, that would make sense!

  6. Colin-b commented on Mar 5, 2021

    @Colin-b
    Contributor

    No that's not on your side, this is a bug in httpx==17.0.0, resolved by #1495 , not yet released on pypi.

  7. johtso commented on Mar 5, 2021

    @johtso
    Contributor

    Whoops! Didn't realise that wasn't in 17.0.0..

  8. florimondmanca commented on Mar 6, 2021

    @florimondmanca
    Contributor

    Yup, in 0.17.0 you should have bumped the minimum HTTPCore version to make sure 0.17.0 shipped with versions that has the retries option. :)

  9. lovelydinosaur commented on Mar 12, 2021

    @lovelydinosaur
    Member

    My post-match review on this is that we ought to have had an httpcore 0.13.0 release, prior to httpx 0.17.0.

    If we're pinning to >= httpcore minor version numbers, then we've got something (slightly) wrong.

    Not a big deal, just worth mentioning.

    (At this point tho' I think we just want to have a minor httpx release that pins to httpcore >= 0.12.1)

  10. lovelydinosaur commented on Mar 12, 2021

    @lovelydinosaur
    Member

    Slightly related discussion... #1504

  11. changed the title [-]httpx.Client() fails on latest release[/-] [+]Incompatible with httpcore 0.12.0[/+] on Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions