Exemple #1
0
def create(subjCod):
    config = configuration.load_config_file('polical.yaml')
    client = TrelloClient(
        api_key=config['api_key'],
        api_secret=config['api_secret'],
        token=config['oauth_token'],
        token_secret=config['oauth_token_secret'],
    )
    member_id = config['owner_id']
    subjectsBoard = client.get_board(config['board_id'])
    if (connectSQLite.check_no_subjectID(subjCod) == 1):
        subject_name = connectSQLite.getSubjectName(subjCod)
        print(subject_name)
        id = ""
        for x in subjectsBoard.list_lists():
            if x.name == subject_name:
                id = x.id
        if id == "":
            subjectsBoard.add_list(subject_name)
            for x in subjectsBoard.list_lists():
                if x.name == subject_name:
                    id = x.id
        subject = MateriaClass.Materia(subject_name, subjCod, id)
        print(subject.print())
        sql = connectSQLite.saveSubjectID(subject)
        for row in sql.fetchall():
            print(row)
        sql = connectSQLite.getdb().close()
Exemple #2
0
def Add_Subject_To_Trello_List(subjectsBoard, subject_name, subjCod):
    id = ""
    for x in subjectsBoard.list_lists():
        if x.name == subject_name:
            id = x.id
    if id == "":
        subjectsBoard.add_list(subject_name)
        for x in subjectsBoard.list_lists():
            if x.name == subject_name:
                id = x.id
    subject = MateriaClass.Materia(subject_name, subjCod, id)
    print(subject.print())
    sql = connectSQLite.saveSubjectID(subject)
    for row in sql.fetchall():
        print(row)
    sql = connectSQLite.getdb().close()
import MateriaClass
import TareaClass
import csv
import connectSQLite
from trello import TrelloClient
try:
    with open('materias.csv') as csv_file:
        csv_reader = csv.reader(csv_file, delimiter=';')
        line_count = 0
        for row in csv_reader:
            if line_count == 0:
                print(f'Column names are {", ".join(row)}')
                line_count += 1
            else:
                subject = MateriaClass.Materia(row[1], row[0])
                print(subject.print())
                sql = connectSQLite.saveSubjects(subject)
                for row in sql.fetchall():
                    print(row)
                sql = connectSQLite.getdb().close()
except:
    print("FALSE")
#            line_count += 1
#    print(f'Processed {line_count} lines.')