Exemplo n.º 1
0
    def __init__(self) -> None:
        super().__init__()
        self.try_get_access_token()

        configuration = Configuration()
        configuration.access_token = self.try_get_access_token()

        self.client = ApiClient(configuration=configuration)
        self.activitiesApi = ActivitiesApi(api_client=self.client)
        self.athletesApi = AthletesApi(api_client=self.client)
Exemplo n.º 2
0
    def __init__(self, *args, **keywords):
        super(ApplianceControlApp, self).__init__(*args, **keywords)
        api_client_config = Configuration()
        api_client_config.host = os.environ.get("TEST_HOST", "localhost") + ":8080"
        api_client_config.logger_file = "/tmp/api.log"
        api_client = ApiClient(configuration=api_client_config)
        self.management_api = ManagementApi(api_client)
        self.licensing_api = LicensingApi(api_client)

        self.keypress_timeout_default = 25
        self.appliance_type = "RT"
Exemplo n.º 3
0
    def __init__(self, context, id, name, register=False):
        self.context = context
        self.id = id
        self.name = name
        self.register = register

        self.fastapi = FastAPI()

        configuration = Configuration()
        configuration.host = "%s/ari" % context.api_endpoint
        configuration.username = context.api_username
        configuration.password = context.api_password

        self.api_client = swagger_client.ApiClient(configuration)
Exemplo n.º 4
0
 def __init__(self, alertmanager_address):
     self.configuration = Configuration()
     self.configuration.host = alertmanager_address
     api_client = ApiClient(configuration=self.configuration)
     self.general_api = swagger_client.GeneralApi(api_client=api_client)
     self.alerts_api = swagger_client.AlertApi(api_client=api_client)
     self.receiver_api = swagger_client.ReceiverApi(api_client=api_client)
     self.silence_api = swagger_client.SilenceApi(api_client=api_client)
Exemplo n.º 5
0
    def __init__(self, config, id, name, register=False):
        super(Application, self).__init__(config, id, name, register)

        self.config = config
        self.id = id
        self.name = name
        self.register = register

        self.fastapi = FastAPI()

        self.contextes = dict()

        configuration = Configuration()
        configuration.host = "%s/ari" % config.api_endpoint
        configuration.username = config.api_username
        configuration.password = config.api_password

        self.api_client = swagger_client.ApiClient(configuration)
Exemplo n.º 6
0
 def __init__(self, sourceId, conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     self.h = hp206c.hp206c()
Exemplo n.º 7
0
 def __init__(self, sensorport, sourceId, name, unit="", conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     self.sensorport = sensorport
     self.name = name
     self.unit = unit
Exemplo n.º 8
0
 def __init__(self, sourceId, conf=Configuration()):
     self.sourceId = sourceId
     self.conf = conf
     self.apiClient = ApiClient(configuration=self.conf)
     self.api = DefaultApi(api_client=self.apiClient)
Exemplo n.º 9
0
 def get_configuration(self):
     configuration = Configuration()
     configuration.host = self.nexus_server_url + "/service/rest"
     configuration.verify_ssl = False
     configuration.debug = True
     return configuration
Exemplo n.º 10
0
import time
import datetime

from swagger_client import DefaultApi, ApiClient, Configuration, SensorData
from swagger_client.rest import ApiException

from sensors.sensors import DigitalTemperatureHumiditySensorThread,LoudnessSensorThread,AirQualitySensorThread,\
    BarometerSensorThread,SunlightSensorThread,DigitalLightSensorThread,MotionSensor,DustSensorThread

if __name__ == '__main__':
    conf = Configuration()
    conf.host = "http://192.168.178.35:8080/v1"
    sourceId = "pi-1"

    sensors = [
        DigitalTemperatureHumiditySensorThread(sensorport=4, sourceId=sourceId, conf=conf),
        LoudnessSensorThread(sensorport=0, sourceId=sourceId, conf=conf),
        AirQualitySensorThread(sensorport=2, sourceId=sourceId, conf=conf),
#        BarometerSensorThread(sourceId=sourceId, conf=conf),
        SunlightSensorThread(sourceId=sourceId, conf=conf),
#        DigitalLightSensorThread(sourceId=sourceId, conf=conf),
        MotionSensor(sensorport=8, sourceId=sourceId, conf=conf),
        DustSensorThread(sourceId=sourceId, conf=conf)
    ]

    while True:
        for sensor in sensors:
            sensor.sendData()
        time.sleep(1)
Exemplo n.º 11
0
from pprint import pprint

import numpy as np
import swagger_client
from swagger_client import ApiClient, Configuration, VectorModel, VectorListModel, VectorDataListModel, VectorDataModel
from swagger_client.rest import ApiException

d = 128  # dimension

config = Configuration()
config.host = "http://localhost:8000/api"
config.debug = False
client = ApiClient(config)

# create an instance of the API class
api_instance = swagger_client.DbApi(client)
db_name = 'my_database'
index_name = "basic_index"

try:
    # delete a database
    api_response = api_instance.delete_db(db_name)
    # pprint(api_response)
except ApiException as e:
    print("Exception when calling DbApi->delete_db: %s\n" % e)

try:
    # Create a database
    payload = swagger_client.DatabaseCreationModel(name=db_name)
    api_response = api_instance.post_db(payload)
    # pprint(api_response)
Exemplo n.º 12
0
 def __init__(self, sourceId, conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     self.sensor = SI1145.SI1145()
Exemplo n.º 13
0
 def __init__(self, sensorport, sourceId, conf=Configuration()):
     AnalogValueSensor.__init__(self,
                                sensorport,
                                sourceId,
                                name="air",
                                conf=conf)
Exemplo n.º 14
0
 def __init__(self, sourceId, conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     grovepi.dust_sensor_en()
Exemplo n.º 15
0
 def __init__(self, sensorport, sourceId, conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     self.sensorport = sensorport
     grovepi.pinMode(self.sensorport, "INPUT")
Exemplo n.º 16
0
 def __init__(self, sensorport, sourceId, conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     self.sensorport = sensorport
Exemplo n.º 17
0
 def __init__(self, sourceId, conf=Configuration()):
     Sensor.__init__(self, sourceId, conf)
     lightsensor.init()