Compare commits

..

No commits in common. "8901831568800e9a8e7d658ec811535478a41053" and "be4db13179049133a612e567d5fc3146e4980bfb" have entirely different histories.

View file

@ -146,8 +146,6 @@ def start_oauth() -> Response:
flask.session["owner_key"] = fetch_response.get("oauth_token")
flask.session["owner_secret"] = fetch_response.get("oauth_token_secret")
assert flask.session["owner_key"] and flask.session["owner_secret"]
base_authorization_url = f"https://{wiki_hostname}/wiki/Special:OAuth/authorize"
authorization_url = oauth.authorization_url(
base_authorization_url, oauth_consumer_key=client_key
@ -164,8 +162,8 @@ def oauth_callback() -> werkzeug.wrappers.response.Response:
oauth = OAuth1Session(
client_key,
client_secret=client_secret,
resource_owner_key=flask.session.get("owner_key"),
resource_owner_secret=flask.session.get("owner_secret"),
resource_owner_key=flask.session["owner_key"],
resource_owner_secret=flask.session["owner_secret"],
)
oauth_response = oauth.parse_authorization_response(flask.request.url)
@ -259,7 +257,7 @@ def get_best_hit(title: str, hits: list[Hit]) -> tuple[Hit, dict[str, typing.Any
raise NoGoodHit
@app.route("/link/<path:url_title>", methods=["GET", "POST"])
@app.route("/<path:url_title>", methods=["GET", "POST"])
def article_page(url_title: str) -> str | Response:
"""Article page."""
from_title = url_title.replace("_", " ").strip()
@ -345,8 +343,8 @@ def api_hits() -> werkzeug.wrappers.response.Response:
@app.route("/api/1/valid_hit")
def api_valid_hit() -> werkzeug.wrappers.response.Response:
"""Return canidates for the given article title."""
link_from = flask.request.args["link_from"]
link_to = flask.request.args["link_to"]
link_from = flask.request.args.get("link_from")
link_to = flask.request.args.get("link_to")
try:
diff, replacement = get_diff(link_to, link_from, None)