question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatible with httpx 0.15.x

See original GitHub issue

Hey there, absolutely love this library! 😄

Sadly httpx 0.15.x seems to have changed the Response class and now VCR.py won’t run successfully after upgrading httpx. Specifically, the http_version kwarg being passed no longer exists in httpx.


    @patch("httpx.Response.close", MagicMock())
    @patch("httpx.Response.read", MagicMock())
    def _from_serialized_response(request, serialized_response, history=None):
        content = serialized_response.get("content").encode()
>       response = httpx.Response(
            status_code=serialized_response.get("status_code"),
            request=request,
            http_version=serialized_response.get("http_version"),
            headers=_from_serialized_headers(serialized_response.get("headers")),
            content=content,
            history=history or [],
        )
E       TypeError: __init__() got an unexpected keyword argument 'http_version'

Commenting out the line below resolves the issue, but I’m not sure how you can still pass the version correctly:

@patch("httpx.Response.close", MagicMock())
@patch("httpx.Response.read", MagicMock())
def _from_serialized_response(request, serialized_response, history=None):
    content = serialized_response.get("content").encode()
    response = httpx.Response(
        status_code=serialized_response.get("status_code"),
        request=request,
        #http_version=serialized_response.get("http_version"),
        headers=_from_serialized_headers(serialized_response.get("headers")),
        content=content,
        history=history or [],
    )
    response._content = content
    return response

Huge love and thanks Fotis

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kevin1024commented, Oct 5, 2020

Thanks! Just merged #562 so closing this issue, but feel free to ping me if I don’t get around to doing a new release soon.

1reaction
jairhenriquecommented, Oct 5, 2020

@fgimian @kevin1024 #562 solves this issue! I have same problem 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

httpx · PyPI
It includes an integrated command line client, has support for both HTTP/1.1 and HTTP/2, and provides both sync and async APIs. Install HTTPX...
Read more >
Exceptions - HTTPX
This page lists exceptions that may be raised when using HTTPX. For an overview of how to work with HTTPX exceptions, see Exceptions...
Read more >
Unhelpful conflict messages #4373 - ocaml/opam - GitHub
Please add your unhelpful conflict message to this discussion *** While trying to install expect.0.0.6 on OCaml 4.12: [ERROR] Package conflict!
Read more >
Can't install Scipy through pip - Stack Overflow
After opening up an issue with the SciPy team, we found that you need to upgrade pip with: pip install --upgrade pip. And...
Read more >
HTTP Exceptions — Werkzeug Documentation (2.2.x)
You can get a response object by calling get_response() on a HTTP ... This is used for HTTP basic auth and other schemes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found