title: Paho Python Client with HiveMQ
body: <p>i am developing a module in python that will allow me to connect my raspberry pi to a version of hivemq hosted on my pc.</p>
  
  <p>it connects normally but when i add hivemq's file auth plugin it doesnt seem to work</p>
  
  <p>im using the username_pw_set to set my username and password</p>
  
  <p>here is what my code currently looks like:</p>
  
  <pre><code>import paho.mqtt.client as mqtt
  client = mqtt.Client()
  
  #The callback for when the client recieves a CONNACK response from the server
  def on_connect(client, userdata, flags, rc):
    print("connected with the result code "+str(rc))
  
  
  #Define any topics you would like the pi to
  #automatically subscribe to here
  
  #The callback for when this client publishes to the server.
  def on_publish(client, userdata, mid):
    print("message published")
  
  
  #The callback for when a PUBLISH message is recieve from the server.
  def on_message(client, userdata, msg):
    print(msg.topic+" "+str(msg.payload))
  
  
  def on_log(client, userdata, level, buf):
    print(str(level)+" "+str(buf))
  
  
  #set callbacks
  def setup():
    client.on_connect = on_connect
    client.on_message = on_message
    client.on_publish = on_publish
    client.on_log = on_log
  
  #setup connection to broker
  def connect(username, password):
    client.username_pw_set(username, password)
    client.connect("10.19.109.152")
  
  def publish(topic, message):
    client.publish(topic, message)
  
  def loop():
    client.loop()
  </code></pre>
  
  <p>could it be something to do with the way the python client formats the connect request? </p>
  
  <p>Edit:</p>
  
  <p>Server gives me error message:</p>
  
  <pre><code>2015-11-26 09:50:53,723 ERROR - Could not get valid results from the webservice
  org.apache.http.NoHttpResponseException: The target server failed to respond
      at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(Default
  HttpResponseParser.java:143)
  </code></pre>
  
  <p>and my client(on_connect function) outputs a connack message with code 5 which is for refused connection as its not authorised. </p>