Example #1
0
 def update(self):
     if self.__version["latest_version"] != self.__version[
             "current_version"]:
         result = TBUtility.install_package(
             "thingsboard-gateway", self.__version["latest_version"])
     else:
         result = "Congratulations! You have the latest version."
     return result
Example #2
0
from queue import Queue
from random import choice
from string import ascii_lowercase
from time import sleep, time
from re import fullmatch
from json import JSONDecodeError
import json

from tb_utility.tb_loader import TBModuleLoader
from tb_utility.tb_utility import TBUtility

try:
    from requests import Timeout, request
except ImportError:
    print("Requests library not found - installing...")
    TBUtility.install_package("requests")
    from requests import Timeout, request
import requests
from requests.auth import HTTPBasicAuth
from requests.exceptions import RequestException

from connectors.connector import Connector, log
from connectors.request.json_request_uplink_converter import JsonRequestUplinkConverter
from connectors.request.json_request_downlink_converter import JsonRequestDownlinkConverter

# pylint: disable=E1101
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':ADH-AES128-SHA256'


class RequestConnector(Connector, Thread):
    def __init__(self, gateway, config, connector_type):