用于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使用Eclipse Helios for Web项目   java指定行。作为编译器设置的分隔符?   osm映射中带有osmdroid的java标记   java Android ClassNotFoundException在路径:DexPathList上未找到类   java从j2me调用GWT方法   更新到java 8后的aspectj问题   如何仅从根元素java,com提取文本内容。滴虫软件。是的。html   安卓公司。谷歌。火基。数据库DatabaseException:未能转换java类型的值。将字符串改为长字符串   从java中的方法返回arraylist变量   java如果将引用重新分配给同步块内的锁对象,会是什么?   java下载。使用spring mvc的资源文件中的xlsx文件   java Eclipse提供了什么工具来运行Eclipse中未包含的程序?   spring boot Java泛型如何读取传递给泛型方法的类型上的字段或调用方法   Javacard中的javaecdsa签名