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")
time.sleep(1)
print("Sending 1...")
publish.single("green", "1", hostname="localhost", auth="auth")
time.sleep(0.5)

here the error message

File "blink.py", line 7, in <module>
publish.single("green", "0", hostname="localhost", auth="auth")
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/publish.py", 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/publish.py", line 129, in multiple
username = auth['username']
TypeError: string indices must be integers, not str

need help

Thank you

Rainer
Previous Topic:Thread-safe Paho C messageArrived callback
Next Topic:Proxy aware
Goto Forum:
  


Current Time: Sun Nov 18 05:52:08 GMT 2018

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

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

Back to the top