init with some kind of working prototype

This commit is contained in:
ducklet 2021-06-15 19:09:21 +02:00
commit b5cb22822e
22 changed files with 1292 additions and 0 deletions

36
unwind/__main__.py Normal file
View file

@ -0,0 +1,36 @@
import asyncio
import logging
from . import config
from .db import close_connection_pool, open_connection_pool
from .imdb import load_imdb
from .request import session
log = logging.getLogger(__name__)
async def run_import():
await open_connection_pool()
with session() as s:
s.headers["Accept-Language"] = "en-GB, en;q=0.5"
for name, imdb_id in config.imdb.items():
log.info("Loading data for %s ... ⚡️", name)
await load_imdb(imdb_id)
await close_connection_pool()
def main():
logging.basicConfig(
format="%(asctime)s.%(msecs)03d [%(name)s:%(process)d] %(levelname)s: %(message)s",
datefmt="%H:%M:%S",
level=config.loglevel,
)
log.debug(f"Log level: {config.loglevel}")
asyncio.run(run_import())
main()