Files
visual_critical_discourse_a…/tests/image_download_test.py
T
Brian Bjarke Jensen fd9140093d
Code Quality Pipeline / Test (push) Successful in 4m5s
CI Pipeline / Test (pull_request) Failing after 3m42s
CI Pipeline / Build and Publish (pull_request) Has been skipped
moved webui and updated poetry packages
2024-05-20 19:19:29 +02:00

31 lines
863 B
Python

from __future__ import annotations
import os
from pathlib import Path
from dotenv import load_dotenv
from shared.database import connect
from shared.database.classes import VisualCommunication
if __name__ == '__main__':
# prepare env vars
env_path = Path(__file__).parent.parent / 'local.env'
assert env_path.exists()
load_dotenv(env_path)
os.environ['MONGO_HOST'] = 'localhost'
# connect to database
collection, db, client = connect()
print(client.server_info())
# download images
data = None
for data in collection.find().limit(3):
if data is None:
print('no document found')
break
vis_com: VisualCommunication = VisualCommunication.model_validate(data)
print(repr(vis_com))
if data is not None:
print(vis_com.image)
print(vis_com.model_dump())