paho.mqtt.python
paho.mqtt.python copied to clipboard
Nicer print in Getting Started example
Using the connack_string and error_string functions to print nicer messages in the Getting Started example.
Makes it easier for users to understand issues without searching for lists of these codes online
I believe this will no longer be needed with 2.0 version that is arriving soon (a pre-release is already available). With the newer version, when using the CallbackAPI version 2, it's no longer an integer rc that is received but an ReasonCodes instance, which is printed as string.
Not everything is well aligned currently: master branch contains the development branch with latest change (the 2.0 version) but the README is not yet updated. See https://github.com/eclipse/paho.mqtt.python/pull/804 for README matching version 2.0
So the getting started will result in:
>>> print(f"Connected with result code {reason_code}")
Connected with result code Success
Closing as I believe the issue is fixed with latest release. Feel free to re-open if you still have an issue.