You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

40 lines
1.1 KiB

from quart import Quart, request, render_template, redirect
import ebay
app = Quart(__name__)
@app.route("/", methods=["GET", "POST"])
async def main():
locale = request.args.get('locale')
if not locale:
locale = "com"
if request.method == "POST":
query = (await request.form)["search"]
# NOTE: technically unnecessary redirect for the sake of having the search string shown inside the url
return redirect("/?q=" + query + "&locale=" + locale)
query = request.args.get("q")
if query != None:
results =, 1, locale)
return await render_template("results.html", results=results, query=query)
return await render_template("index.html")
async def article(identifier, rest):
locale = request.args.get('locale')
if not locale:
locale = "com"
return await render_template(
"article.html", article=ebay.article(identifier + "/" + rest, locale)
if __name__ == "__main__":