Skip to content

Use httpx instead of requests #360

@lemon24

Description

@lemon24

Requests is great and battle-tested, but suffers from a number of issues, which may never get fixed due to feature freeze:

Bad reasons to move away from Requests:

  • lack of async support – I have no plan for reader async support at this point
  • lack of support for Brotli/Zstandard encodings – urllib3 does support them

Reasons to move to httpx:

  • largely Requests-compatible API
  • while the ecosystem is probably not comparable, the basics (mocking, auth) are there
  • default timeouts (and more kinds than Requests has)
  • requests/response hooks (the writable response.next_request attribute should allow for hooks to trigger retries, which should allow getting rid of SessionWrapper entirely)
  • URL normalization
  • HTTP2 support (but I don't think we're in any hurry for this)

Reasons to not move to httpx:

  • not 1.0 yet (but coming soon)
  • not as battle-tested as Requests (but can support urllib3 if needed)

Important: Under no circumstances will reader support both Requests and httpx – the entire point of using a high level library like this is to have a single abstraction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions