用于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什么类似于安卓中iOS的VOIP推送和呼叫工具包,用于呼叫   java广播接收器第二次不工作   从maven本地导入java   java如何在jdbc中执行oracle过程   java单击按钮时如何更改JButton上的图像?   java Univocity如何将3(n)行解析为一行(bean)   java消除了字符串中出现的所有特定模式   javascript为什么Js不能从我的web服务目录加载图像文件?   pdf如何在没有AdobeAcrobat的情况下在Java中自动创建字段   反思如何以编程方式创建java文件   AmazonWeb服务java。木卫一。IOException:尝试读取aws s3存储桶上的关闭流   java如何在kotlin中映射基于升序的数组列表和排序   java执行一个方法的时间片段出现   不使用'synchronized'关键字的java线程安全代码?   使用Java小程序在浏览器中滚动至顶部   避免“ZLIB输入流意外结束”的java计时要求