This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A Python logging handler using MQTT protocol.

Installation

pip install mqtthandler

Example usage

import mqtthandler
import logging
import time

mqtthdlr = mqtthandler.MQTTHandler('server.mqtt.com', 'topic/test')
mqtthdlr.setLevel(logging.INFO)

logger = logging.getLogger()
logger.addHandler(mqtthdlr)
logger.setLevel(logging.INFO)

logging.info('test')  # Automatically connecting to the MQTT broker if not connected (equal to loop_start()) and sending log message to MQTT broker
logging.info('test 2')

# Wait for log being sent to the MQTT broker
while True:
  time.sleep(1)

# You will only see
#   test 2
# on the broker if QoS = 0.

MQTTHandler will not wait for connected, you have to do it yourself. E.g.

mqtthdlr.loop_start()   # Manually connect to the MQTT server
import time; time.sleep(3)   # A dirty way to wait for MQTT connected
logging.info('test')  # send log message to MQTT broker

MQTTHandler will create a thread to maintain the connection (automatically reconnecting if disconnected) itself. This will make your program never exit. You have to terminate MQTTHandler yourself to stop the MQTTHandler thread.

mqtthdlr.loop_stop()  # Stop MQTT thread

API

MQTTHandler

Constructor

MQTTHandler(host, topic, port=1883, keepalive=60, bind_address='', client_id='', clean_session=True, userdata=None, protocol=mqttc.MQTTv311, qos=0, retain=False)

Reference to paho.mqtt.python.

Methods

loop_start()
loop_stop()
max_inflight_messages_set(inflight)
message_retry_set(retry)
tls_set(ca_certs, certfile=None, keyfile=None, cert_reqs=ss.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLSv1, ciphers=None)
tls_insecure_set(value)
username_pw_set(username, password)
user_data_set(userdata)
will_set(topic, payload=None, qos=0, retain=False)

Reference to paho.mqtt.python.

Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mqtthandler-0.1.3.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Apr 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting