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:Difference of Paho Android Service and Paho Java Client
Goto Forum:
  


Current Time: Fri May 03 08:54:01 GMT 2024

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

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

Back to the top