contentmatcher/search_cloud.py

31 lines
675 B
Python

"""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, get_engine, get_session
from get_files import get_file_list
l = get_file_list()
id = 0 #TODO
for title in l:
if title[-4:] != ".pdf":
continue
card = Card(
id=id,
title=title[:-4],
interest_rate=-1,
owner_id = 1
)
id = id+1
Session = get_session()
with Session() as dbsession:
session.add(card)
session.commit()
session.close()
get_engine().dispose()