Skip to content

Commit d2f4688

Browse files
author
Peter Armstrong
committed
adds username and password check
1 parent aeaad17 commit d2f4688

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/mqtt-all.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ def main():
200200
)
201201

202202
mqtt_client = mqtt.Client(client_id=device_id)
203-
mqtt_client.username_pw_set(args.username, args.password)
203+
if username and password:
204+
mqtt_client.username_pw_set(args.username, args.password)
204205
mqtt_client.on_connect = on_connect
205206
mqtt_client.on_publish = on_publish
206207
mqtt_client.connect(args.broker, port=args.port)

0 commit comments

Comments
 (0)