This commit is contained in:
printfuck 2020-04-20 01:16:44 +02:00
parent 7dd22d74af
commit 4ba097060a
3 changed files with 14 additions and 8 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
__pycache__

12
main.py
View file

@ -13,7 +13,7 @@ from cssselect import HTMLTranslator, SelectorError
import requests as req import requests as req
from io import StringIO from io import StringIO
import web #import web
DB_HOST = "127.0.0.1" DB_HOST = "127.0.0.1"
DB_USER = "dbuser" DB_USER = "dbuser"
@ -172,11 +172,15 @@ def main():
createTableMa(db, "feeds") createTableMa(db, "feeds")
if not createTableIm(db, "feed01"): if not createTableIm(db, "feed01"):
die() die()
rt = Periodic(60*60*1, updateFeed, [db, "feed01"]) updateFeed(db,"feed01")
#rt = Periodic(60*60*1, updateFeed, [db, "feed01"])
while True: while True:
time.sleep(5) time.sleep(5)
if __name__ == "__main__":
main()
class lf: class lf:
def __init__(self, db, name): def __init__(self, db, name):
@ -266,7 +270,7 @@ class lf:
"feeds",self.name,self.url,self.password, "feeds",self.name,self.url,self.password,
self.username,self.selector, self.username,self.selector,
self.selector_login_user,self.selector_login_pass, self.selector_login_user,self.selector_login_pass,
self.selector_login_verify,self.selector_login_url self.selector_login_verify,self.selector_login_url,
self.selector_login_verify_url) self.selector_login_verify_url)
) )
else: else:
@ -280,7 +284,7 @@ class lf:
self.url,self.password, self.url,self.password,
self.username,self.selector, self.username,self.selector,
self.selector_login_user,self.selector_login_pass, self.selector_login_user,self.selector_login_pass,
self.selector_login_verify,self.selector_login_url self.selector_login_verify,self.selector_login_url,
self.selector_login_verify_url) self.selector_login_verify_url)
) )

9
web.py
View file

@ -7,8 +7,9 @@ from flask import Flask,request
app = Flask(__name__) app = Flask(__name__)
def run_flask(host,port) def run_flask(host,port):
app.run(host=host, port=port) app = Flask(host=host, port=port)
app.run()
def getFeeds(db): def getFeeds(db):
db = getDb() db = getDb()
@ -21,7 +22,7 @@ def getFeeds(db):
return feeds return feeds
@app.route('/') @app.route('/')
def list() def list():
feeds = getFeeds() feeds = getFeeds()
a = "<html><body><p>Header</p><br><table><tr><td>Feeds</td></tr>" a = "<html><body><p>Header</p><br><table><tr><td>Feeds</td></tr>"
for i in feeds: for i in feeds:
@ -53,4 +54,4 @@ def configure(feed_name):
<label for="{}">{}</label><br> <label for="{}">{}</label><br>
<input type="text" value="{}" id="{}"> <input type="text" value="{}" id="{}">
'''.format(i,i,feed.query_db(i),i) '''.format(i,i,feed.query_db(i),i)
a += "</form></body></html> a += "</form></body></html>"