import os import logging logging.basicConfig( format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s: - %(message)s', level=logging.DEBUG if os.environ.get('DEBUG') else logging.INFO) logging.getLogger('aiohttp').setLevel(logging.DEBUG if os.environ.get('DEBUG') else logging.WARNING) import asyncio from aiohttp import web from datetime import datetime, timedelta import pytz app = web.Application() from influxdb import InfluxDBClient client = InfluxDBClient('localhost', 8086, database='sensors1') async def get_thermostat(): pass async def index(request): return web.Response(text='hello world', content_type='text/html') if __name__ == '__main__': app.router.add_get('/', index) loop = asyncio.get_event_loop() loop.create_task(get_thermostat()) web.run_app(app, port=6903)