Incompatible with httpx 0.15.x
See original GitHub issueHey 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:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@fgimian @kevin1024 #562 solves this issue! I have same problem 😄