From 966c28d8f80892f2868e01d3f48a117902e85e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Fri, 4 Sep 2020 13:20:30 +0200 Subject: [PATCH] Make routes Twitter specific --- endpoint.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/endpoint.py b/endpoint.py index d01ceec..da1aa61 100644 --- a/endpoint.py +++ b/endpoint.py @@ -79,16 +79,16 @@ def setup_webhook(api): return True -@app.route('/auth') -def auth(): +@app.route('/twitter/auth') +def twitter_auth(): handler = tweepy.OAuthHandler(consumer_key, consumer_secret, callback_url) url = handler.get_authorization_url() flask.session['request_token'] = handler.request_token return flask.redirect(url) -@app.route('/callback') -def callback(): +@app.route('/twitter/callback') +def twitter_callback(): request_token = flask.session['request_token'] del flask.session['request_token'] handler = tweepy.OAuthHandler(consumer_key, consumer_secret, callback_url) @@ -107,8 +107,8 @@ def callback(): return 'Success', 200 -@app.route('/webhook', methods=['GET']) -def webhook_get(): +@app.route('/twitter/webhook', methods=['GET']) +def twitter_webhook_get(): crc = flask.request.args.get('crc_token') if not crc: return 'Invalid request', 403 @@ -116,8 +116,8 @@ def webhook_get(): return dict(response_token='sha256={0}'.format(base64.b64encode(digest).decode())), 200 -@app.route('/webhook', methods=['POST']) -def webhook_post(): +@app.route('/twitter/webhook', methods=['POST']) +def twitter_webhook_post(): def verify(): signature = flask.request.headers.get('X-Twitter-Webhooks-Signature') if not signature: