response_code Property
The response code.
Syntax
def get_response_code() -> str: ... def set_response_code(value: str) -> None: ...
response_code = property(get_response_code, set_response_code)
Default Value
""
Remarks
When the class is operating in client mode (i.e., the listening property is disabled), this property is populated with the response code included in incoming responses anytime the on_request_complete event fires.
When the class is operating in server mode (i.e., the listening property is enabled), this property specifies the response code that should be included in outgoing responses (regardless of whether they are sent immediately after on_request fires, or later using send_response or send_notification).
In either case, the valid set of values for this property are strings of the format c.dd, where c is a class value in the range 2 to 7, and dd is a detail value in the range 00 to 31.
The following table provides a (non-exhaustive) list of some of the more common response codes; refer to the IANA's CoAP Response Codes registry for a full list.
Code | Description |
2.01 | Created |
2.02 | Deleted |
2.03 | Valid |
2.04 | Changed |
2.05 | Content |
2.31 | Continue |
4.00 | Bad Request |
4.01 | Unauthorized |
4.02 | Bad Option |
4.03 | Forbidden |
4.04 | Not Found |
4.12 | Precondition Failed |
5.00 | Internal Server Error |
5.01 | Not Implemented |
5.02 | Bad Gateway |
5.03 | Service Unavailable |
5.04 | Gateway Timeout |