Open vdusek opened 9 months ago
http_client.call
returns a httpx.Response
which is in some cases enhanced with a _maybe_parsed_body
. It's a bit of a hack which was really useful when we still used requests
, and simplified the code a lot, but when we switched to using httpx
and did some more changes, it ended up being used only in one method, when fetching a key-value store record body. So now we could put the "maybe" response parsing into that method, instead of having it in the http_client
, to have a better separation of concerns, and less hacks.
My IDE was not able to recognize that, instead it raised an accessing of non-existing field error. The self.http_client.call
is annotated to return httpx.Response
object. So it might be the source of the problem.
Yeah, that's probably it. I wonder how this ever passed lint without a #noqa
comment 🤷
Yeah, that's probably it. I wonder how this ever passed lint without a #noqa comment 🤷
I think because accessing fields is checked by Mypy. That's the reason why there is # type: ignore
.
It seems that the following code:
returns a response of type
httpx.Response
. Later the field_maybe_parsed_body
is accessed:There are 2 occurrences of this:
Check if
http_client.call
really returns a httpx.Response object and in such case fix the accessing of non-existing field_maybe_parsed_body
.