用于mqtt的netcat

mqttcat的Python项目详细描述


概述

用于mqtt的netcat

  • 自由软件:BSD 2条款许可证

安装

这需要Python3.6。在命令行:

pip3 install mqttcat

如果您的系统没有提供Python3.6,一种更舒适的方法是使用MQTTtool docker 集装箱。请看Github repo

文档

Usage: mqttcat [OPTIONS] URL

  A MQTT Message filter inspired by netcat and other Unix tools.

  Publishes Messages from STDIN to a MQTT Topic

    -or-

  Subscribes to MQTT Topic and writes messages to STDOUT

  URL - Examples:

      mqtt://hostname/topic     tcp://hostname:1883/topic
      ws://hostname/topic

  Usage Examples:

      mqttcat --echo mqtt://localhost/%23 >/dev/null

      ... will subscribe to all topics ("%23" is urlencoded #), and echo
      them to STDERR for control

      echo "Heart ... beat" | mqttcat --echo --loop --wait=3.3
      mqtt://localhost/heartbeat-topic

      ... will publish "Heart ... beat" every 3.3 seconds to the topic
      "heartbeat-topic"

      mqttcat mqtt://source/ticktock | rq 'filter (a) => { a.payload="tock"
      }' | mqttcat mqtt://destination/tock

      ... subscribe to ticktock topic on host source, filter out the
      messages whose payload is tock,     and forward those to the tock
      topic (using the rq tool https://github.com/dflemstr/rq)

Options:
  --loglevel TEXT             Python loglevel, one of
                              DEBUG,INFO,WARNING,ERROR,CRITICAL
  --echo / --no-echo          Echo MQTT Messages to STDERR
  --source TEXT               File to read MQTT messages to be published (use
                              '-' for STDIN)
  --wait FLOAT                Wait time between publishing messages read from
                              --source in seconds (can be float)
  --loop / --no-loop          Loop message publishing (starting at beginning
                              of file after the end is reached
  --follow / --no-follow      Wait for additional in file after reaching the
                              end (like Unix 'tail -f')
  --destination TEXT          Append JSON-encoded MQTT messages to this file
                              (use '-' for STDOUT)
  --snapshot / --no-snapshot  Keep only the last JSON-encoded message in the
                              file specified with --destination
  --help                      Show this message and exit.

作者

这个模块是Smart Orchestra Project的一部分,由 Federal Ministery of Economics and Technology

变更日志

0.1.0(2018-03-20)

  • pypi上的第一个版本。

0.1.1(2018-04-13)

  • flak8兼容

0.1.2(2018-04-14)

  • 在命令行中添加了–source和–destination选项
  • 源文件可以用–follow跟在后面(如'tail-f')
  • 目标文件只能包含最后一条消息(带有–snapshot)
  • emitTargets.py中提取的目的地

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java是否可以将一半的文本绘制成不同的颜色?   java如何在Eclipse中生成Javadoc HTML文件?   带有时间戳的java“select”preparedStatement返回始终为空的记录集   java将无符号类型写入Netty ChannelBuffer   java动态资源名称   java lookupDefaultPrintService()不返回系统默认打印机   java如何在播放模板中翻译#{get'title'/}?   java为什么JSR352的ItemWriter接口中有一个checkpointInfo?有任何示例实现吗?   在方法外部声明的Java引用变量存在于堆栈或堆上   java类、异常、用户输入   java JApplet通过Eclipse而不是web浏览器连接到本地主机Mysql   java soap metro转储