contentmatcher/search_cloud.py

31 lines
707 B
Python
Raw Normal View History

2022-05-02 14:15:51 +02:00
"""from newxtloud get a list of titles to populate DB"""
from requests import session
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from config import CONFIG
from create_db import Base, Card
from get_files import get_file_list
engine = create_engine(CONFIG['DB_CONNECTION'])
Base.metadata.bind = engine
DBSsession = sessionmaker(bind=engine)
session = DBSsession()
l = get_file_list()
id = 0 #TODO
for title in l:
if title[-4:] == ".pdf":
card = Card(
id=id,
title=title[:-4],
interest_rate=-1,
owner_id = 1
)
session.add(card)
session.commit()
session.close()
2022-05-02 14:15:51 +02:00
id = id+1