def start_bottle(): ################################################################################################ # Create device ################################################################################################ _weather = Weather() _sunrisesunset = SunsetSunrise() log_internal(logPass, logDescDeviceObjectCreation, description='success') ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/weather/all', method=['OPTIONS']) @route('/weather/location', method=['OPTIONS']) @route('/weather/forecast/<option>', method=['OPTIONS']) @route('/weather/sunrise-sunset/<date>', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return enable_cors(response) @get('/weather/all') def api_get_all(): response = get_all(request, _weather, _sunrisesunset) return enable_cors(response) @get('/weather/location') def api_get_location(): response = get_location(request, _weather) return enable_cors(response) @get('/weather/forecast/<option>') def api_get_forecast(option): response = get_forecast(request, _weather, option) return enable_cors(response) @get('/weather/sunrise-sunset/<date>') def api_get_sunrisesunset(date): response = get_sunrisesunset(request, _weather, _sunrisesunset, date) return enable_cors(response) ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
def start_server(): ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/news/headlines/<option>', method=['OPTIONS']) @route('/news/sources/<option>', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return enable_cors(response) @get('/news/headlines/<option>') def api_get_headlines(option): response = get_headlines(request, option) return enable_cors(response) @get('/news/sources/<option>') def api_get_sources(option): response = get_sources(request, option) return enable_cors(response) @get('/news/config.html') def api_get_news_config_html(): response = get_news_config_html(request) return enable_cors(response) @get('/news/config.js') def api_get_news_config_js(): response = get_news_config_js(request) return enable_cors(response) @post('/news/config/update') def api_post_news_config_update(): response = post_news_config_update(request) return enable_cors(response) ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) cache.logQ.put({ 'timestamp': datetime.now(), 'process': 'internal', 'result': logPass, 'operation': logDescPortListener.format(port=port), 'description': 'started' })
def start_bottle(): ################################################################################################ # APIs ################################################################################################ @get('/config') def api_get_config(): return get_config(request) @get('/') def api_get_ui_index(): return get_ui_index(request) @get('/config/config.js') def api_get_ui_config(): return get_ui_config(request) @get('/static/<type>/<filename>') def api_get_ui_resource(type, filename): return get_ui_resource(request, type, filename) @get('/favicon.ico') def api_get_ui_favicon(): return get_ui_favicon(request) @get('/images/<type>/<filename>') def api_get_ui_image(type, filename): return get_ui_image(request, type, filename) @get('/modules/<module>/<filename>') def api_get_ui_module(module, filename): return get_ui_module(request, module, filename) @post('/modules') def api_post_ui_config(): return post_ui_modules(request) ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
def start_bottle(): ################################################################################################ # Create device ################################################################################################ _tvlistings = TVlistings() log_internal(logPass, logDescDeviceObjectCreation, description='success') ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/tvlistings/all', method=['OPTIONS']) @route('/tvlistings/channel/<channame>', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return response @get('/tvlistings/all') def api_get_tvlistings_all(): response = get_tvlistings_all(request, _tvlistings) return response @get('/tvlistings/channel/<channame>') def api_get_tvlistings_channel(channame): response = get_tvlistings_channel(request, _tvlistings, channame) return response ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
def start_bottle(): ################################################################################################ # Create device ################################################################################################ _xbox = Xboxone() log_internal(logPass, logDescDeviceObjectCreation, description='success') ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/powerstatus', method=['OPTIONS']) @route('/command', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return response @get('/powerstatus') def api_get_powerstatus(): response = get_powerstatus(request, _xbox) return response @post('/command') def api_post_command(): response = post_command(request, _xbox) return response ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
def start_bottle(): ################################################################################################ # Create device ################################################################################################ _nest = Nest() log_internal(logPass, logDescDeviceObjectCreation, description='success') ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/all', method=['OPTIONS']) @route('/structures', method=['OPTIONS']) @route('/structure/<structure_id>', method=['OPTIONS']) @route('/devices', method=['OPTIONS']) @route('/devices/<device_type>', method=['OPTIONS']) @route('/devices/<device_type>/<device_id>', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return enable_cors(response) @get('/all') def api_get_all(): response = get_all(request, _nest) return enable_cors(response) @get('/structures') def api_get_structures(): response = get_structures(request, _nest) return enable_cors(response) @get('/structure/<structure_id>') def api_get_structure_specific(structure_id): response = get_structure_specific(request, _nest, structure_id) return enable_cors(response) @get('/devices') def api_get_devices(): response = get_devices(request, _nest) return enable_cors(response) @get('/devices/<device_type>') def api_get_devices_type(device_type): response = get_devices_type(request, _nest, device_type) return enable_cors(response) @get('/devices/<device_type>/<device_id>') def api_get_device_specific(device_type, device_id): response = get_device_specific(request, _nest, device_type, device_id) return enable_cors(response) @post('/devices/<device_type>/<device_id>') def api_post_device_specific(device_type, device_id): response = post_device_specific(request, _nest, device_type, device_id) return enable_cors(response) ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
from log.log import log_internal from portlistener import start_bottle try: ################################ log_internal(logPass, logDescStartingService, description='started') ################################ # Initiate service broadcast process_broadcast = Process(target=broadcast_service, args=( get_cfg_serviceid(), get_cfg_port(), )) process_broadcast.start() ################################ # Port_listener log_internal(logPass, logDescPortListener.format(port=get_cfg_port()), description='starting') start_bottle() process_broadcast.terminate() log_internal(logPass,
def start_server(): ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/icloud/<option>/all', method=['OPTIONS']) @route('/icloud/<option>/today', method=['OPTIONS']) @route('/icloud/<option>/tomorrow', method=['OPTIONS']) @route('/icloud/<option>/date/<dateSpecific>', method=['OPTIONS']) @route('/icloud/<option>/daterange/datefrom/<dateFrom>/dateto/<dateTo>', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return enable_cors(response) @get('/icloud/authentication/2fa/2fa.html') def api_get_2fa_html(): return get_2fa_html(request) @get('/icloud/authentication/2fa/2fa.js') def api_get_2fa_js(): return get_2fa_js(request) @post('/icloud/authentication/2fa/code/request') def api_post_2fa_code_request(): return post_2fa_code_request(request) @post('/icloud/authentication/2fa/code/validate') def api_post_2fa_code_validate(): return post_2fa_code_validate(request) @get('/icloud/<option>/all') def api_get_calendar_all(option): response = get_calendar_all(request, option) return enable_cors(response) @get('/icloud/<option>/today') def api_get_calendar_today(option): response = get_calendar_today(request, option) return enable_cors(response) @get('/icloud/<option>/tomorrow') def api_get_calendar_tomorrow(option): response = get_calendar_tomorrow(request, option) return enable_cors(response) @get('/icloud/<option>/date/<dateSpecific>') def api_get_calendar_date(option, dateSpecific): response = get_calendar_date(request, option, dateSpecific) return enable_cors(response) @get('/icloud/<option>/daterange/datefrom/<dateFrom>/dateto/<dateTo>') def api_get_calendar_daterange(option, dateFrom, dateTo): response = get_calendar_daterange(request, option, dateFrom, dateTo) return enable_cors(response) ################################################################################################ # TODO - further API URIs ################################################################################################ uri_get_devices = '/icloud/devices' uri_get_device_location = '/icloud/device/<deviceid>/location' uri_get_device_status = '/icloud/device/<deviceid>/status' uri_post_device_playsound = '/icloud/device/<deviceid>/playsound' uri_post_device_lostmode = '/icloud/device/<deviceid>/lostmode' uri_get_contacts = '/icloud/contacts' uri_get_files = '/icloud/files' uri_get_photos = '/icloud/photos' ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) cache.logQ.put({'timestamp': datetime.now(), 'process': 'internal', 'result': logPass, 'operation': logDescPortListener.format(port=port), 'description': 'started'})
def start_bottle(): ################################################################################################ # Create device ################################################################################################ _tvlgnetcast = TvLgNetcast() log_internal(logPass, logDescDeviceObjectCreation, description='success') ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/apps/all', method=['OPTIONS']) @route('/apps/single/<auid>', method=['OPTIONS']) @route('/commands', method=['OPTIONS']) @route('/command/<command>', method=['OPTIONS']) @route('/command/cursor/<command>', method=['OPTIONS']) @route('/command/touch/<command>', method=['OPTIONS']) @route('/volume', method=['OPTIONS']) @route('/3d', method=['OPTIONS']) @route('/img/screenshot', method=['OPTIONS']) @route('/img/appicon/<auid>', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return response @get('/apps/all') def api_get_apps_all(): response = get_apps_all(request, _tvlgnetcast) return response @get('/apps/single/<auid>') def api_get_apps_single(auid): response = get_apps_single(request, _tvlgnetcast, auid) return response @get('/commands') def api_get_commands(): response = get_commands(request, _tvlgnetcast) return response @post('/command/keyInput') def api_post_command_keyInput(): response = post_command_keyInput(request, _tvlgnetcast) return response @post('/command/executeApp') def api_post_command_executeApp(): response = post_command_executeApp(request, _tvlgnetcast) return response @post('/command/cursor/visibility') def api_post_command_cursorVisbility(): response = post_command_cursorVisbility(request, _tvlgnetcast) return response @post('/command/touch/move') def api_post_command_touchMove(): response = post_command_touchMove(request, _tvlgnetcast) return response @post('/command/touch/click') def api_post_command_touchClick(): response = post_command_touchClick(request, _tvlgnetcast) return response @post('/command/touch/wheel') def api_post_command_touchWheel(): response = post_command_touchWheel(request, _tvlgnetcast) return response @get('/volume') def api_get_volume(): response = get_volume(request, _tvlgnetcast) return response @get('/3d') def api_get_3d(): response = get_3d(request, _tvlgnetcast) return response @get('/img/screenshot') def api_get_image_screenshot(): response = get_image_screenshot(request, _tvlgnetcast) return response @get('/img/appicon/<auid>') def api_get_image_appicon(auid): response = get_image_appicon(request, _tvlgnetcast, auid) return response ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
def start_bottle(): ################################################################################################ # Create device ################################################################################################ _virginmedia_tivo = Virginmedia_tivo() log_internal(logPass, logDescDeviceObjectCreation, description='success') ################################################################################################ # APIs ################################################################################################ @route('/config', method=['OPTIONS']) @route('/commands', method=['OPTIONS']) @route('/command', method=['OPTIONS']) @route('/channel', method=['OPTIONS']) @route('/channels', method=['OPTIONS']) @route('/checkchannels', method=['OPTIONS']) @route('/recordings', method=['OPTIONS']) @route('/enterpin', method=['OPTIONS']) def api_cors_options(**kwargs): return response_options() @get('/config') def api_get_config(): response = get_config(request) return response @get('/commands') def api_get_commands(): response = get_commands(request, _virginmedia_tivo) return response @post('/command') def api_post_command(): response = post_command(request, _virginmedia_tivo) return response @get('/channel') def api_get_channel(): response = get_channel(request, _virginmedia_tivo) return response @get('/channels') def api_get_channels(): response = get_channels(request, _virginmedia_tivo) return response @get('/checkchannels') def api_get_checkchannels(): response = get_checkchannels(request) return response @post('/channel') def api_post_channel(): response = post_channel(request, _virginmedia_tivo) return response @get('/recordings') def api_get_recordings(): response = get_recordings(request, _virginmedia_tivo) return response @post('/enterpin') def api_post_enterpin(): response = post_enterpin(request, _virginmedia_tivo) return response ################################################################################################ host = '0.0.0.0' port = get_cfg_port() run(host=host, port=port, server='paste', debug=True) log_internal(logPass, logDescPortListener.format(port=port), description='started')
from resources.global_resources.log_vars import logPass, logException from config.config import get_cfg_serviceid, get_cfg_port from discovery.broadcast import broadcast_service from log.log import log_internal from portlistener import start_bottle try: ################################ log_internal(logPass, logDescStartingService, description='started') ################################ # Initiate service broadcast process_broadcast = Process(target=broadcast_service, args=(get_cfg_serviceid(), get_cfg_port(), )) process_broadcast.start() ################################ # Port_listener log_internal(logPass, logDescPortListener.format(port=get_cfg_port()), description='starting') start_bottle() process_broadcast.terminate() log_internal(logPass, logDescPortListener.format(port=get_cfg_port()), description='stopped') except Exception as e: log_internal(logException, logDescStartingService, description='fail', exception=e)
'timestamp': datetime.now(), 'process': 'internal', 'result': logPass, 'operation': logDescStartingService, 'description': 'started' }) ################################ # Initiate logging process_logging = Process(target=logging_service) process_logging.start() ################################ # Initiate service broadcast process_broadcast = Process(target=broadcast_service, args=( get_cfg_serviceid(), get_cfg_port(), )) process_broadcast.start() ################################ # Start service code start_service() ################################ # Port_listener cache.logQ.put({ 'timestamp': datetime.now(), 'process': 'internal', 'result': logPass, 'operation': logDescPortListener.format(port=get_cfg_port()), 'description': 'starting' }) start_server()