Files
gallery/gallery/main.py
T
2026-09-03 19:47:42 +03:00

42 lines
1.2 KiB
Python

from os import environ
from pathlib import Path
import uvicorn
from gallery.easel import build_app
from gallery.painting.gismeteo.api import GismeteoApi
from gallery.painting.matchtv.api import MatchTvApi
from gallery.painting.openweather.api import OpenWeatherApi
from gallery.painting.rp5.api import RP5WeatherApi
from gallery.painting.yandextv.api import YandexTvApi
from gallery.painting.yandexweather.api import YandexWeatherApi
from gallery.sketch.bundle import ApiBundle
from gallery.sketch.schedule.cached import CachedScheduleApi
from gallery.sketch.weather.cached import CachedWeatherApi
api = ApiBundle(
[
CachedScheduleApi(YandexTvApi()),
CachedScheduleApi(MatchTvApi()),
CachedWeatherApi(GismeteoApi()),
CachedWeatherApi(OpenWeatherApi()),
CachedWeatherApi(YandexWeatherApi()),
CachedWeatherApi(RP5WeatherApi()),
]
)
app = build_app(api)
def run():
uvicorn.run(
"gallery.main:app",
host=environ.get("GALLERY_HOST", "0.0.0.0"),
port=int(environ.get("GALLERY_PORT", 8000)),
log_config=str(Path(__file__).parent / "logging.yaml"),
reload="DEBUG" in environ,
)
if __name__ == "__main__":
run()