...
 
Commits (5)
env
# Created by .ignore support plugin (hsz.mobi)
### Example user template template
### Example user template
......
......@@ -16,7 +16,7 @@ def send_to_kindle(title, filename, key, engine):
connection = engine.connect()
# check if the user is a local one
toaddr = connection.execute("SELECT kindle_url FROM news.user WHERE key = '{}'".format(key))[0]
toaddr = connection.execute("SELECT kindle_url FROM news.user WHERE user.key = '{}'".format(key)).first()[0]
print(toaddr)
......
......@@ -3,7 +3,7 @@ import os
from flask import Flask, render_template, flash, request
from wtforms import Form, TextField, validators
from sqlalchemy import create_engine
from send_to_kindle import send_to_kindle
from server.send_to_kindle import send_to_kindle
from server import parse_compu_wo
# App config.
......@@ -40,11 +40,11 @@ def save_url():
return render_template('url_form.html', form=form)
"""
if app.config['DEBUG']:
#if app.config['DEBUG']:
#engine = create_engine('sqlite:////azk/azk/test.db', echo=True)
engine = None
else:
engine = create_engine('mysql://news_reader:{}@{}/news'.format(os.environ['MYSQL_PW'], os.environ['MYSQL_HOST']),
# engine = None
#else:
engine = create_engine('mysql://news-reader:{}@{}/news'.format(os.environ['MYSQL_PW'], os.environ['MYSQL_HOST']),
pool_pre_ping=True)
......@@ -52,7 +52,7 @@ else:
def save_from_app():
if request.form.get("url") and request.form.get("key"):
outputFilename, title= parse_compu_wo.process_one_url(request.form.get("url"))
title, outputFilename = parse_compu_wo.process_one_url(request.form.get("url"))
send_to_kindle(title, outputFilename, request.form.get("key"), engine)
......@@ -69,7 +69,7 @@ def test_post():
if request.method == 'POST':
for obj in request.form.items():
print(obj)
return '', 200
return request.data, 200
else:
return '', 400
......