Skip to content
Snippets Groups Projects
Commit b366507d authored by fxk8y's avatar fxk8y :spider:
Browse files

Reordering import

parent 5969b0f4
No related branches found
No related tags found
No related merge requests found
from typing import Callable
import yaml import yaml
import json import json
import random import random
import logging import logging
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
from typing import Callable
######################################## ########################################
#### #### #### ####
...@@ -372,6 +373,13 @@ class SpiderMQTT: ...@@ -372,6 +373,13 @@ class SpiderMQTT:
return self.connected return self.connected
def publish(self, topic, payload=None, qos=0, retain=False, prettyPrintYAML=False) -> None: def publish(self, topic, payload=None, qos=0, retain=False, prettyPrintYAML=False) -> None:
# ######################################################
# ### USE issubclass(…) INSTEAD AND TEST FOR IT!!! ###
# ######################################################
# what we did here is bad style and contrary to what we want to achieve :/
if isinstance(payload, str): if isinstance(payload, str):
pl = payload.encode('utf-8') pl = payload.encode('utf-8')
elif isinstance(payload, (bool, int, float, complex)): elif isinstance(payload, (bool, int, float, complex)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment