Make routes Twitter specific

master
Nikola Forró 4 years ago
parent 6efa8a47cc
commit 966c28d8f8

@ -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:

Loading…
Cancel
Save