From 20186924f2bee5b1241dcd07840d7af8dcdd878a Mon Sep 17 00:00:00 2001 From: Marius Kriegerowski Date: Sun, 4 Apr 2021 18:22:42 +0200 Subject: [PATCH] refactor scripts hbmqtt->amqtt --- amqtt/scripts/pub_script.py | 18 +++++++++--------- amqtt/scripts/sub_script.py | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/amqtt/scripts/pub_script.py b/amqtt/scripts/pub_script.py index e8285de..b5b1edc 100644 --- a/amqtt/scripts/pub_script.py +++ b/amqtt/scripts/pub_script.py @@ -2,12 +2,12 @@ # # See the file license.txt for copying permission. """ -hbmqtt_pub - MQTT 3.1.1 publisher +amqtt_pub - MQTT 3.1.1 publisher Usage: - hbmqtt_pub --version - hbmqtt_pub (-h | --help) - hbmqtt_pub --url BROKER_URL -t TOPIC (-f FILE | -l | -m MESSAGE | -n | -s) [-c CONFIG_FILE] [-i CLIENT_ID] [-q | --qos QOS] [-d] [-k KEEP_ALIVE] [--clean-session] [--ca-file CAFILE] [--ca-path CAPATH] [--ca-data CADATA] [ --will-topic WILL_TOPIC [--will-message WILL_MESSAGE] [--will-qos WILL_QOS] [--will-retain] ] [--extra-headers HEADER] [-r] + amqtt_pub --version + amqtt_pub (-h | --help) + amqtt_pub --url BROKER_URL -t TOPIC (-f FILE | -l | -m MESSAGE | -n | -s) [-c CONFIG_FILE] [-i CLIENT_ID] [-q | --qos QOS] [-d] [-k KEEP_ALIVE] [--clean-session] [--ca-file CAFILE] [--ca-path CAPATH] [--ca-data CADATA] [ --will-topic WILL_TOPIC [--will-message WILL_MESSAGE] [--will-qos WILL_QOS] [--will-retain] ] [--extra-headers HEADER] [-r] Options: -h --help Show this screen. @@ -40,10 +40,10 @@ import asyncio import os import json -import hbmqtt -from hbmqtt.client import MQTTClient, ConnectException +import amqtt +from amqtt.client import MQTTClient, ConnectException from docopt import docopt -from hbmqtt.utils import read_yaml_config +from amqtt.utils import read_yaml_config logger = logging.getLogger(__name__) @@ -55,7 +55,7 @@ def _gen_client_id(): pid = os.getpid() hostname = socket.gethostname() - return "hbmqtt_pub/%d-%s" % (pid, hostname) + return "amqtt_pub/%d-%s" % (pid, hostname) def _get_qos(arguments): @@ -138,7 +138,7 @@ def main(*args, **kwargs): logger.fatal("Error: Python 3.6+ is required") sys.exit(-1) - arguments = docopt(__doc__, version=hbmqtt.__version__) + arguments = docopt(__doc__, version=amqtt.__version__) # print(arguments) formatter = "[%(asctime)s] :: %(levelname)s - %(message)s" diff --git a/amqtt/scripts/sub_script.py b/amqtt/scripts/sub_script.py index 7d3057d..456f3ce 100644 --- a/amqtt/scripts/sub_script.py +++ b/amqtt/scripts/sub_script.py @@ -2,12 +2,12 @@ # # See the file license.txt for copying permission. """ -hbmqtt_sub - MQTT 3.1.1 publisher +amqtt_sub - MQTT 3.1.1 publisher Usage: - hbmqtt_sub --version - hbmqtt_sub (-h | --help) - hbmqtt_sub --url BROKER_URL -t TOPIC... [-n COUNT] [-c CONFIG_FILE] [-i CLIENT_ID] [-q | --qos QOS] [-d] [-k KEEP_ALIVE] [--clean-session] [--ca-file CAFILE] [--ca-path CAPATH] [--ca-data CADATA] [ --will-topic WILL_TOPIC [--will-message WILL_MESSAGE] [--will-qos WILL_QOS] [--will-retain] ] [--extra-headers HEADER] + amqtt_sub --version + amqtt_sub (-h | --help) + amqtt_sub --url BROKER_URL -t TOPIC... [-n COUNT] [-c CONFIG_FILE] [-i CLIENT_ID] [-q | --qos QOS] [-d] [-k KEEP_ALIVE] [--clean-session] [--ca-file CAFILE] [--ca-path CAPATH] [--ca-data CADATA] [ --will-topic WILL_TOPIC [--will-message WILL_MESSAGE] [--will-qos WILL_QOS] [--will-retain] ] [--extra-headers HEADER] Options: -h --help Show this screen. @@ -37,12 +37,12 @@ import asyncio import os import json -import hbmqtt -from hbmqtt.client import MQTTClient, ConnectException -from hbmqtt.errors import MQTTException +import amqtt +from amqtt.client import MQTTClient, ConnectException +from amqtt.errors import MQTTException from docopt import docopt -from hbmqtt.mqtt.constants import QOS_0 -from hbmqtt.utils import read_yaml_config +from amqtt.mqtt.constants import QOS_0 +from amqtt.utils import read_yaml_config logger = logging.getLogger(__name__) @@ -53,7 +53,7 @@ def _gen_client_id(): pid = os.getpid() hostname = socket.gethostname() - return "hbmqtt_sub/%d-%s" % (pid, hostname) + return "amqtt_sub/%d-%s" % (pid, hostname) def _get_qos(arguments): @@ -115,7 +115,7 @@ def main(*args, **kwargs): logger.fatal("Error: Python 3.6+ is required") sys.exit(-1) - arguments = docopt(__doc__, version=hbmqtt.__version__) + arguments = docopt(__doc__, version=amqtt.__version__) formatter = "[%(asctime)s] :: %(levelname)s - %(message)s" if arguments["-d"]: