@app.after_request
def after_request(response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# # Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use SQLite database
db = SQL("sqlite:///deepwork.db")


@app.route("/", methods=["GET", "POST"])
@login_required
def index():
    """
    Home Page where user can log timed tasks.
    """
    # If user logged time
    if request.method == "POST":
        # JSON data format[hours, minutes, seconds, startTime, startDate, stopTime, stopDate, taskDescription, deepworkBool]
        data = request.get_json()

        # Ensure user has recorded time
        if not data['startTime']:
Example #2
0
        response.headers["Expires"] = 0
        response.headers["Pragma"] = "no-cache"
        return response


# custom filter
app.jinja_env.filters["usd"] = usd

# configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# configure CS50 Library to use SQLite database
db = SQL("sqlite:///finance.db")


@app.route("/")
@login_required
def index():

    # Sometimes the alphavantage API has issues, if it is unable to provide the neccessary
    # data to present the portfolio, route the user to the "quote" template
    # https://www.alphavantage.co/documentation/
    try:
        user = db.execute("SELECT username FROM users WHERE id=:id",
                          id=session['user_id'])
        logging.info(user)

        # Retrieve the stock symbol(s) and the corresponding number of shares from the portfoilo table
Example #3
0
class Stock(object):
    '''
    Stock database handeling
    '''
    def __init__(self, source="sqlite:///finance.db"):
        self.db = SQL(source)

    def __str__(self):
        '''
        Returns the total amount of stocks in a string
        '''
        rows = self.db.execute("SELECT * FROM stocks")
        total = 0
        for row in rows:
            total += row["amount"]
        return f'Stock database contains {total} stocks'

    def get_stocks(self, user_id):
        '''
        Returns a list of stocks corresponding to an ID number
        '''
        all_stocks = self.db.execute(
            "SELECT stock FROM stocks WHERE id = :username", username=user_id)
        list_stocks = []
        for stock in all_stocks:
            list_stocks.append(stock['stock'])
        return list_stocks

    def get_portfolio(self, user_id):
        '''
        Returns the row in JSON of a user
        '''
        all_stocks = self.db.execute(
            "SELECT * FROM stocks WHERE id = :username", username=user_id)
        return all_stocks

    def get_amount(self, user_id, stock):
        '''
        Returns amount of stocks corresponding to an ID, if NONE returns 0.
        '''
        stock = stock.upper()
        amount = self.db.execute(
            "SELECT amount FROM stocks WHERE id = :username AND stock = :stock",
            username=user_id,
            stock=stock)
        if amount:
            return amount[0]['amount']
        else:
            return 0

    def stock_zero(self, user_id, stock):
        '''
        Checks if Stock is None/empty
        '''
        stock_info = self.db.execute(
            "SELECT amount FROM stocks WHERE id = :username AND stock = :stock",
            username=user_id,
            stock=stock)
        if len(stock_info) > 0:
            return False
        else:
            return True

    def delete_stock(self, user_id, stock):
        '''
        Deletes stock of user.
        '''
        self.db.execute(
            "Delete FROM stocks WHERE id = :username and stock = :stock",
            username=user_id,
            stock=stock)
        return True

    def add_stock(self, user_id, stock, amount):
        '''
        Adds stock of user
        '''
        self.db.execute(
            "INSERT INTO stocks (id, stock, amount)"
            "VALUES (:username, :stock ,:amount)",
            username=user_id,
            stock=stock,
            amount=amount)
        return True

    def set_stock(self, user_id, stock, amount):
        '''
        Updates stock of user
        '''
        old_amount = self.db.execute(
            "SELECT amount FROM stocks "
            "WHERE id = :username AND stock = :stock",
            username=user_id,
            stock=stock)

        amount = old_amount[0]["amount"] + amount
        self.db.execute(
            "UPDATE stocks SET amount = :amount "
            "WHERE id = :username AND stock = :stock",
            amount=amount,
            username=user_id,
            stock=stock)
        return True
Example #4
0
# TODO
from sys import argv
import csv
from cs50 import SQL

db = SQL("sqlite:///students.db")


#function for reading with all condition
def enter(csv_read_var):
    fist_exception = 0
    for i in csv_read_var:
        if fist_exception == 0:
            fist_exception += 1
            continue
        if len(i[0].split()) < 3:
            name = i[0].split()
            #print("if name " , name)
            db.execute(
                "INSERT INTO students (first , middle , last , house , birth) VALUES(? , ? , ? , ? , ?)",
                name[0], "NONE", name[1], i[1], i[2])
        else:
            name = i[0].split()
            #print("else name" , name)
            db.execute(
                "INSERT INTO students (first , middle , last , house , birth) VALUES(? , ? , ? , ? , ?)",
                name[0], name[1], name[2], i[1], i[2])


#reading from csv using function
with open(argv[1], 'r') as csv_file:
Example #5
0
import time
import datetime
import flask
import sqlite3

from cs50 import SQL
from flask import Flask, flash, jsonify, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError
from werkzeug.security import check_password_hash, generate_password_hash
from helper import login_required, usd, timeformater
from engine import orderbook_sync
from app import app

db = SQL('sqlite:///DB.db')


@app.route('/', methods=['GET'])
def home():
    return render_template("home.html")


@app.route("/trade")
@login_required
def trade():
    """Trading Interface"""
    return render_template("trade.html")


@app.route("/funding")
Example #6
0
import os
import requests
import urllib.parse

from cs50 import SQL
from flask import flash, redirect, render_template, request, session
from functools import wraps

# Finds SQLite3 database
db = SQL("sqlite:///jpthephonesurgeon.db")


def apology(message, code=400):
    """Render message as an apology to user."""
    def escape(s):
        """
        Escape special characters.

        https://github.com/jacebrowning/memegen#special-characters
        """
        for old, new in [("-", "--"), (" ", "-"), ("_", "__"), ("?", "~q"),
                         ("%", "~p"), ("#", "~h"), ("/", "~s"), ("\"", "''")]:
            s = s.replace(old, new)
        return s

    return render_template("auth/apology.html",
                           top=code,
                           bottom=escape(message)), code


def login_required(f):
import tensorflow

import logging
import sys
# Configure application
app = Flask(__name__)

# Ensure templates are auto-reloaded
app.config["TEMPLATES_AUTO_RELOAD"] = True
# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

db = SQL("sqlite:///heart.db")


@app.route("/", methods=["GET", "POST"])
def main():
    return render_template("main.html")


@app.route("/more", methods=["GET", "POST"])
@login_required
def more():
    # Directs the user to the more html when they try to open it
    if request.method == "GET":
        return render_template("more.html")

    # Takes care of the code as the user is trying to fill out the form
Example #8
0
import sys

sys.path.insert(0, "../src")

from cs50 import SQL

db = SQL("mysql://root@localhost/test")
db.execute("SELECT 1")
import os

from cs50 import SQL
from flask import Flask, flash, jsonify, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError
from werkzeug.security import check_password_hash, generate_password_hash

db = SQL("sqlite:///subrecipe.db")


print(subsubrecipes)






Example #10
0
import csv
import urllib.request

from flask import redirect, render_template, request, session
from functools import wraps

import requests
import random
from cs50 import SQL
import ast
from passlib.apps import custom_app_context as pwd_context

db = SQL("sqlite:///trivia.db")


def create_game(player1_id, player2_id):
    """Create a game between two players."""
    # haal vragen op
    vragen = requests.get("https://opentdb.com/api.php?amount=50&category=22&type=multiple")
    # zet vragen in json
    json = vragen.json()
    # shuffle de vragen
    random.shuffle(json["results"])
    # insert de benodigde gegevens in de database
    player1_name = db.execute("SELECT username FROM users WHERE id = :player1_id", player1_id=player1_id)[0]["username"]
    player2_name = db.execute("SELECT username FROM users WHERE id = :player2_id", player2_id=player2_id)[0]["username"]
    db.execute("INSERT INTO games (player1_id, player2_id, questions, player1_name, player2_name) VALUES (:player1_id, :player2_id, :questions, :player1_name, :player2_name)",
               player1_id=player1_id, player2_id=player2_id, questions=str(json), player1_name=player1_name, player2_name=player2_name)
    return db.execute("SELECT max(game_id) FROM games WHERE player1_id = :player1_id AND player2_id = :player2_id",
                      player1_id=player1_id, player2_id=player2_id)[0]["max(game_id)"]
Example #11
0
import csv
import sqlite3
from cs50 import SQL
from sys import argv, exit

if len(argv) == 2:
    db = SQL("sqlite:///students.db")
    lsts = db.execute(
        "SELECT * FROM students WHERE house = (?) ORDER BY last, first",
        argv[1])
    for lst in lsts:
        if lst['middle'] == None:
            print(f"{lst['first']} {lst['last']}, born {lst['birth']}")
        else:
            print(
                f"{lst['first']} {lst['middle']} {lst['last']}, born {lst['birth']}"
            )

else:
    print(f"Error there should be 2 argv, you have {argv}")
    exit(1)
Example #12
0
@app.after_request
def after_request(response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use SQLite database
db = SQL("sqlite:///finalproject.db")


@app.route("/")
@login_required
def index():
    """Show all of the qualities of the website(Main page)"""
    name = db.execute(
        "SELECT username FROM users WHERE id=:id",
        id=session["user_id"])  #name of user queried from database using SQL
    time = datetime.now()  # time is now containing date and time
    return render_template("index.html",
                           username=name[0]["username"],
                           current_time=time.strftime("%d/%m/%Y %H:%M:%S"))

Example #13
0
    def after_request(response):
        response.headers[
            "Cache-Control"] = "no-cache, no-store, must-revalidate"
        response.headers["Expires"] = 0
        response.headers["Pragma"] = "no-cache"
        return response


# logger = logging.getLogger('cs50')
# logger.propagate = False

logger = logging.getLogger('cs50')
logger.disabled = True

# configure CS50 Library to use SQLite database
db = SQL("sqlite:///csv.db")

# On IBM Cloud Cloud Foundry, get the port number from the environment variable PORT
# When running this app on the local machine, default the port to 8000
port = int(os.getenv('PORT', 8000))


# Main Index page
@app.route("/")
def index():

    # Extracting the entire SQlite table and then displaying it.
    rows = db.execute("SELECT * FROM earthquakes WHERE 1")

    return render_template("index.html", rows=rows)
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Configure session to use filesystem (instead of signed cookies)
#app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"

Session(app)

# Configure CS50 Library to use Postgres database
db = SQL(
    "postgres://*****:*****@ec2-54-228-250-82.eu-west-1.compute.amazonaws.com:5432/da5k6k2pjfrag7"
)


@app.route("/")
def landingpage():
    return render_template("landingpage.html")


@app.route("/login", methods=["GET", "POST"])
def login():
    """Log user in"""

    # Forget any user_id
    session.clear()
@app.after_request
def after_request(response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use SQLite database
db = SQL("sqlite:///gcapp.db")


@app.route("/")
@login_required
def index():
    return render_template("index.html")


@app.route("/check", methods=["GET"])
def check():

    username = request.args.get("username")

    usernames = db.execute(
        "SELECT username FROM users WHERE username = :username",
Example #16
0
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Custom filter
app.jinja_env.filters["usd"] = usd

# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use SQLite database
db = SQL("sqlite:///fitness.db")


@app.route("/")
@login_required
def index():
    """Show list of workouts"""

    user = session["user_id"]

    data = db.execute("SELECT * FROM users WHERE id=:current", current=user)

    for line in data:
        # line["name"] = name

        # Render portfolio
Example #17
0
# Configure session to use filesystem (instead of signed cookies)
# The directory where session files are stored. Default to use flask_session directory under current working directory.
app.config["SESSION_FILE_DIR"] = mkdtemp()
# Whether use permanent session or not, default to be True
# By default, all non-null sessions in Flask-Session are permanent.
# Therefore, we must set it to False so Session will expire when logging out
app.config["SESSION_PERMANENT"] = False
# Specifies which type of session interface to use. Builtin: null, redis, memcached, filesystem, mongodb, sqlalchemy
app.config["SESSION_TYPE"] = "filesystem"
# This class is used to add Server-side Session to one or more Flask applications.
# initialize the instance with a very specific Flask application
# Configure CS50 Library to use SQLite database
# #default from CS50 codebase
# db = SQL("sqlite:///finance.db")
# #When hosting with Heroku using Postgresql
db = SQL(os.getenv("DATABASE_URL"))

Session(app)

# Make sure API key is set
if not os.environ.get("API_KEY"):
    raise RuntimeError("API_KEY not set")


@app.route("/")
@login_required
def index():
    """Show portfolio of stocks"""
    empty_porfolio = True
    # Return an array of object
    porfolio = db.execute("SELECT * FROM porfolio WHERE user_id = :user_id",
Example #18
0
@app.after_request
def after_request(response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use mysql database
db = SQL('mysql://*****:*****@localhost/book')


@app.route("/")
def getbooks():
    file = open("books.csv", "r")
    reader = csv.reader(file)
    for row in reader:
        data = db.execute(
            "INSERT INTO books (isbn,title,author,year) VALUES (:isbn,:title,:author,:year)",
            isbn=row[0],
            title=row[1],
            author=row[2],
            year=row[3])
    return True
Example #19
0
from cs50 import SQL
from sys import argv, exit

if len(argv) != 2:
    print("Usage: python roster.py HouseName")
    exit(1)

HouseName = argv[1]
house = []
frist = []
middle = []
last = []
birth = []
num = 0

db = SQL("sqlite:///students.db")
for row in db.execute("SELECT house FROM students GROUP BY house"):
    house.append(row["house"])


def search(Tuple, n):
    flag = 0
    for i in range(len(Tuple)):
        if Tuple[i] == n:
            flag = 1
    if flag == 0:
        print("House Name is wrong it check it again")
        exit(1)


search(house, HouseName)
Example #20
0
        response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
        response.headers["Expires"] = 0
        response.headers["Pragma"] = "no-cache"
        return response

# custom filter
app.jinja_env.filters["usd"] = usd

# configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = gettempdir()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# configure CS50 Library to use SQLite database
db = SQL("sqlite:///projectv2.db")

@app.route("/", methods=["GET", "POST"])
@login_required
def index():
    """Home page."""
    # get todos for user
    rows = db.execute("SELECT todo, category FROM todos WHERE user_id = :id ", id = session["user_id"])

    # initialize index table

    list1, list2, list3, list4 = [], [], [], []
    #store table values
    for i in range(len(rows)):
        if rows[i]["category"] == 1:
            list1.append(rows[i]["todo"])
Example #21
0
import csv
from cs50 import SQL
from flask import Flask

db = SQL("sqlite:///busigence.db")

def main():
    db.execute("CREATE TABLE customers ('customerid' varchar(255),'companyname' varchar(255),'contactname' varchar(255),'contacttitle' varchar(255))")

if __name__ == "__main__":
    main()
Example #22
0
@app.after_request
def after_request(response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure website to use database
db = SQL("sqlite:///cirqitous.db")


# set up redirect for index page to go to main website page
@app.route("/")
@login_required
def index():
    return render_template("distance.html")


# set up distance tab on website to create a distance variable from the user's inputted desired distance and measurement type
@app.route("/distance", methods=["GET", "POST"])
@login_required
def distance():
    """Enable user to look up a distance."""
Example #23
0
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
mail=Mail(app)

app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = '******'
app.config['MAIL_PASSWORD'] = '******'
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
mail = Mail(app)
Session(app)


db = SQL("sqlite:///user.db")

@app.route("/")
def index():
    items=db.execute("SELECT * FROM item")
    return render_template("index.html", items=items)


@app.route("/register", methods=["GET", "POST"])
def register():
    if request.method == "POST":
        result = db.execute("SELECT * FROM user WHERE username = :username",
                            username=request.form.get("username"))
        print("check")
        if result:
             flash("Username is already taken! Please try again.")
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response

# Custom filter
app.jinja_env.filters["usd"] = usd

# Configure session to use filesystem (instead of signed cookies)
app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use SQLite database
db = SQL("sqlite:///finance.db")

# Make sure API key is set
if not os.environ.get("API_KEY"):
    raise RuntimeError("API_KEY not set")


@app.route("/")
@login_required
def index():
    """Show portfolio of stocks"""
    # get the info from the database
    stock = db.execute("SELECT * FROM stocks WHERE user_id = :user", user=session['user_id'])
    cash = db.execute("SELECT cash FROM users WHERE id = :user", user=session['user_id'])[0]['cash']

    # pass the info to the templates and shown on the homepage
Example #25
0
JSGlue(app)

# ensure responses aren't cached
if app.config["DEBUG"]:

    @app.after_request
    def after_request(response):
        response.headers[
            "Cache-Control"] = "no-cache, no-store, must-revalidate"
        response.headers["Expires"] = 0
        response.headers["Pragma"] = "no-cache"
        return response


# configure CS50 Library to use SQLite database
db = SQL("sqlite:///mashup.db")


@app.route("/")
def index():
    """Render map."""
    if not os.environ.get("API_KEY"):
        raise RuntimeError("API_KEY not set")
    return render_template("index.html", key=os.environ.get("API_KEY"))


@app.route("/articles")
def articles():
    """Look up articles for geo."""

    # ensure parameters are present
Example #26
0
from cs50 import SQL
from sys import argv, exit
from csv import DictReader

# chaking command line arguments along with file type(.csv)
if len(argv) != 2 or not (argv[1].endswith('.csv')):
    print("Usage: Invalid argument(s) number or file type")
    exit(1)

#set up a database connection
db = SQL("sqlite:///students.db")

# to update student id
count = 1

# to open csv file
with open(argv[1], newline='') as csv_file:
    studentDic = DictReader(csv_file)

    for row in studentDic:
        # to store splited list of name
        namelist = str.split(row["name"])

        #inserting into student.db
        if len(namelist) == 2:
            #to perform insert query
            db.execute(
                "INSERT INTO students(id, first, middle, last, house, birth) VALUES (?, ?, ?, ?, ?, ?)",
                count, namelist[0], None, namelist[1], row["house"],
                row["birth"])
        elif len(namelist) == 3:
Example #27
0
from cs50 import SQL


db = SQL("sqlite:///immuns.db")

def idArange(user):
    countries = db.execute("SELECT * FROM :user", user=user)
    x = 1
    for country in countries:
        db.execute("UPDATE :user SET id=:idx WHERE id=:firstID", user=user, idx=x, firstID=country["id"])
        x = x + 1

#idArange("msen")
#idArange("mssp")
#idArange("hsen")
#idArange("hssp")

#idArange("generalList")

#idArange("Marissa Aguilar_ASFM")
Example #28
0
def after_request(response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    response.headers["Expires"] = 0
    response.headers["Pragma"] = "no-cache"
    return response


# Configure session to use filesystem (instead of signed cookies)
#app.config["SESSION_FILE_DIR"] = mkdtemp()  # Only use when running locally
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Configure CS50 Library to use SQLite database
db = SQL(
    "postgres://*****:*****@ec2-52-86-116-94.compute-1.amazonaws.com:5432/d5t0i8j478i083"
)
# sqlite:///fallguys.db


@app.route("/", methods=["GET", "POST"])
@login_required
def index():
    """Enter new wins/losses"""

    if request.method == "GET":

        # Get list of games
        finals = db.execute(
            "SELECT * FROM fallguystracker.games WHERE mode='final'")
        nonfinals = db.execute(
Example #29
0
 def __init__(self, source="sqlite:///finance.db"):
     self.db = SQL(source)
Example #30
0
import csv
import sys
from cs50 import SQL

db = SQL("sqlite:///students.db")
strCharacters = str(sys.argv[1])
NULL = None
my_Sql_push = ''

if strCharacters != NULL:
    with open(strCharacters, 'r', encoding='ISO-8859-1') as csvB:
        #csvBase = csv.reader(csvB)
        csvBase = csv.DictReader(csvB)
        for row in csvBase:
            ### Creating new keys inside Dictionary
            row['middle'] = ''
            row['last'] = ''

            ### Part fullname
            split = row['name'].split()

            row['name'] = split[0]

            if len(split) == 3:
                row['middle'] = split[1]
                row['last'] = split[2]

            else:
                row['middle'] = None
                row['last'] = split[1]