Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » syntax for auth with paho connecting to mqtt(cant find correct syntax)
syntax for auth with paho connecting to mqtt [message #1755553] Sun, 05 March 2017 16:58
Rainer Müller-Knoche is currently offline Rainer Müller-KnocheFriend
Messages: 1
Registered: March 2017
Junior Member
Trying and search since hours to find the correct systax
Here my phyton scrip

import paho.mqtt.publish as publish
import time

auth ={'username':"username", 'password':"password"}

print("Sending 0...")
publish.single("green", "0", hostname="localhost", auth="auth")
print("Sending 1...")
publish.single("green", "1", hostname="localhost", auth="auth")

here the error message

File "", line 7, in <module>
publish.single("green", "0", hostname="localhost", auth="auth")
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/", line 223, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls, protocol, transport)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/", line 129, in multiple
username = auth['username']
TypeError: string indices must be integers, not str

need help

Thank you

Previous Topic:Thread-safe Paho C messageArrived callback
Next Topic:Difference of Paho Android Service and Paho Java Client
Goto Forum:

Current Time: Mon May 17 01:44:56 GMT 2021

Powered by FUDForum. Page generated in 0.02147 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top