You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -34,14 +42,15 @@ To register a response processor you need to import the Processing class and the
34
42
print(client.get_entities())
35
43
36
44
37
-
In this example.
45
+
In this example.
38
46
The first processor (a function wrapped with the processor decorator) is going to be called when we receive a response that has that as its :code:`Content-Type` header.
39
-
Because :code:`homeassistant_api` provides processors for :code:`application/octet-stream`and :code:`application/json` by default,
40
-
we need to tell :code:`homeassistant_api` to override the default processor with :code:`override=True`.
47
+
:code:`homeassistant_api` provides processors for :code:`application/octet-stream`and :code:`application/json` by default,
48
+
But :code:`@Processing.processor` gives the most recently registered processor the highest precedence when choosing a processor for a response.
49
+
So our processor here will be chosen over the default processors.
41
50
42
-
The second processor is an async processor that only gets called when AsyncClient receives a response that has :code:`text/csv`as its :code:`Content-Type` header.
43
-
If you wanted to override :code:`homeassistant_api`'s default json processing using the :code:`json` module with a different way to process json data.
44
-
Such as using instead, the :code:`ujson` module (which is faster but more limiting).
51
+
The second processor is an async processor that only gets called when Client receives an async response that has :code:`text/csv`as its :code:`Content-Type` header.
52
+
If you wanted, you could not use :code:`homeassistant_api`'s default json processing using the :code:`json` module,
53
+
and use instead the :code:`ujson` module (which is faster but more restrictive).
45
54
46
55
The third processor function implements the default processor function for the :code:`application/json` mimetype after printing a string.
47
56
If you wanted to run some intermediate processing.
0 commit comments