contentmatcher/search_cloud.py

30 lines
683 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
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()
id = id+1