Learn how to use listeners in your application using the squarecloud python sdk.
APP_STATUS
, LOGS
, or BACKUP
. This function should take two parameters:
before
(represents the state after the request)after
(represents the state before the request)before
and after
depends on which endpoint the listener is “listening” to. If it is the APP_STATUS route, it will receive a StatusData
, LOGS will receive a LogsData
, and BACKUP will receive a BackupData
.
As you may have noticed in the example above, the first time the comparison between the logs occurs, after != before
returns True. This happens precisely because after is equal to LogsData(logs='')
, as there is still nothing stored in the cache internally.
Additional information about this decorator
endpopint
parameter, it
receives an Endpoint
class, so the name of the function that the decorator
wraps is up to you.__init__
will be called).response
parameter (of type squarecloud.http.Response
) will
be returned.avoid_listener=True
parameter so that the application listener is not called.squarecloud.http.Response
objects.
extra
, and this will be passed to your listener