Exemplo n.º 1
0
 def __init__(self, aws_iot_endpoint, client_certificate, private_key,
              root_ca, client_id, conn_disconnect_timeout,
              mqtt_oper_timeout):
     self.logger = logging.get_logger(__name__)
     self.endpoint = aws_iot_endpoint
     self.client_certificate = client_certificate
     self.private_key = private_key
     self.root_ca = root_ca
     self.client_id = client_id
     self.conn_disconnect_timeout = conn_disconnect_timeout
     self.mqtt_oper_timeout = mqtt_oper_timeout
Exemplo n.º 2
0
 def __init__(self):
     self.logger = logging.get_logger(__name__)
     self.lte = LTE()
Exemplo n.º 3
0
 def __init__(self):
     self.logger = logging.get_logger(__name__)
     self.client = microcoapy.Coap()
Exemplo n.º 4
0
# -*- coding: utf-8 -*-
import usocket as socket

import config
import machine

from lib import logging
from nce.network.network_connector import NetworkConnector

logging.basic_config(level=logging.INFO)
logger = logging.get_logger("__main__")

if __name__ == '__main__':
    message = "Hello, UDP. Can you hear me?".encode()

    logger.info("Opening UDP Socket")
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    addr = socket.getaddrinfo(config.UDP_ENDPOINT_ADDRESS,
                              config.UDP_ENDPOINT_PORT)[0][-1]
    logger.info("Resolved Address [{}]".format(addr))
    logger.info("Sending UDP message to {}:{} with body {}".format(
        config.UDP_ENDPOINT_ADDRESS, config.UDP_ENDPOINT_PORT, message))
    s.sendto(message, addr)
    logger.info("Sent UDP Message to the UDP Broker")

    logger.info("Closing the network connection")
    NetworkConnector().disconnect()
    machine.idle()
Exemplo n.º 5
0
 def __init__(self, endpoint, private_key_path, certificate_pem_path, root_ca_crt_path):
     self.logger = logging.get_logger(__name__)
     self.endpoint = endpoint
     self.private_key_path = private_key_path
     self.certificate_pem_path = certificate_pem_path
     self.root_ca_crt_path = root_ca_crt_path
#!/usr/bin/env python3

import asyncio
import pickle
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional, Union

import click
from lib.auth import CredentialsProvider
from lib.logging import format_number, get_logger
from lib.message_fetcher import BatchedMessageFetcher, MessageFetcher
from lib.service import ServiceProvider

LOGGER = get_logger()


@dataclass
class LabelData:
    id: str
    name: str
    type: str
    size: int = 0
    count: int = 0

    def is_relevant(self) -> bool:
        return self.count > 0 and self.type != "system"

    def __str__(self) -> str:
        return f"{self.name} {self.count} {format_number(self.size)}"
Exemplo n.º 7
0
 def __init__(self, root_ca_url):
     self.logger = logging.get_logger(__name__)
     self.root_ca_url = root_ca_url
Exemplo n.º 8
0
 def __init__(self):
     super().__init__(**bot_info)
     self._eligible_roles = config.read_eligible_roles()
     self._eligible_channels = config.read_eligible_channels()
     self._logger = logging.get_logger()