|
|
@ -3,7 +3,8 @@ logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=lo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Flask application to serve the web pages
|
|
|
|
# Flask application to serve the web pages
|
|
|
|
from flask import Flask, render_template, request, redirect, url_for
|
|
|
|
from flask import Flask, request, redirect, url_for
|
|
|
|
|
|
|
|
from flask_mako import MakoTemplates, render_template
|
|
|
|
|
|
|
|
|
|
|
|
# Mediawiki client to interact with the Wiki
|
|
|
|
# Mediawiki client to interact with the Wiki
|
|
|
|
import mwclient
|
|
|
|
import mwclient
|
|
|
@ -45,6 +46,7 @@ class PrefixMiddleware(object):
|
|
|
|
|
|
|
|
|
|
|
|
# create flask application
|
|
|
|
# create flask application
|
|
|
|
app = Flask(__name__)
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
MakoTemplates(app)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Url prefix for the soupboat
|
|
|
|
# Url prefix for the soupboat
|
|
|
@ -87,8 +89,13 @@ def get_pads():
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
html = site.api('parse', prop='text', page=padliography)
|
|
|
|
html = site.api('parse', prop='text', page=padliography)
|
|
|
|
pads = BeautifulSoup(html['parse']['text']['*']).find("table", attrs={"class":"padliography"})
|
|
|
|
table = BeautifulSoup(html['parse']['text']['*']).find("table", attrs={"class":"padliography"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headers = [header.text.lower().strip() for header in table.find_all('th')]
|
|
|
|
|
|
|
|
pads = [
|
|
|
|
|
|
|
|
{headers[i]: cell.text for i, cell in enumerate(row.find_all('td'))}
|
|
|
|
|
|
|
|
for row in table.find_all('tr')]
|
|
|
|
|
|
|
|
pads = [ pad for pad in pads if pad != {}]
|
|
|
|
return pads
|
|
|
|
return pads
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|