def test_get_base_path(self): self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('127.0.0.1', 'api/api2')) self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('127.0.0.1/', 'api/api2')) self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('http://127.0.0.1', 'api/api2')) self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('http://127.0.0.1', '/api/api2')) self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('http://127.0.0.1', '/api/api2/')) self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('127.0.0.1', '//api/api2/')) self.assertEqual('http://127.0.0.1/api/api2', tools.get_base_path('http://127.0.0.1', '/api//api2')) self.assertEqual( 'http://127.0.0.1/api/api2', tools.get_base_path('http://127.0.0.1//', '/api//api2'))
def __init__(self, raw_data, hub_ip=None, loop=None, websession=None): if ATTR_ROOM in raw_data: raw_data = raw_data.get(ATTR_ROOM) ApiResource.__init__(self, loop, websession, get_base_path(hub_ip, 'api/rooms'), raw_data)
def __init__(self, hub_ip, loop, websession=None): ApiEntryPoint.__init__(self, loop, websession, get_base_path(hub_ip, URL_ROOMS))
def __init__(self, raw_data, hub_ip=None, loop=None, websession=None): if ATTR_SCENE in raw_data: raw_data = raw_data.get(ATTR_SCENE) ApiResource.__init__( self, loop, websession, get_base_path(hub_ip, URL_SCENES), raw_data)
def __init__(self, raw_data, hub_ip, loop, websession=None): if ATTR_SCENE_MEMBER in raw_data: raw_data = raw_data.get(ATTR_SCENE_MEMBER) ApiResource.__init__(self, loop, websession, raw_data) self._base_path = get_base_path(hub_ip, URL_SCENE_MEMBERS)
def __init__(self, raw_data, hub_ip=None, loop=None, websession=None): if ATTR_SHADE in raw_data: raw_data = raw_data.get(ATTR_SHADE) ApiResource.__init__(self, loop, websession, get_base_path(hub_ip, URL_SHADES), raw_data) self._shade_position = Position(raw_data.get(ATTR_TYPE))
def __init__(self, hub_ip, loop, websession=None): ApiEntryPoint.__init__(self, loop, websession,get_base_path(hub_ip, 'api/userdata'))
def __init__(self, hub_ip, loop, websession=None): ApiBase.__init__(self, loop, websession) self.ip_address = hub_ip self.request = AioRequest(loop, websession) self._base_path = get_base_path(hub_ip, 'api')
def __init__(self, request: AioRequest, base_path): self.request = request self._base_path = get_base_path(request.hub_ip, base_path)
def __init__(self, raw_data, hub_ip, loop, websession=None): if ATTR_USER_DATA in raw_data: raw_data = raw_data.get(ATTR_USER_DATA) ApiResource.__init__(self, loop, websession, raw_data) self._base_path = get_base_path(hub_ip, 'api/userdata')