-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
29 lines (27 loc) · 832 Bytes
/
Copy pathapp.py
File metadata and controls
29 lines (27 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, request
from queue import Queue
import logging
import sys
import os
app = Flask(__name__)
app.mp_queue = Queue()
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
@app.route('/auth', methods=['GET','POST'])
def get_auth():
oauth_token = request.args.get('oauth_token')
oauth_verifier = request.args.get('oauth_verifier')
d = {'oauth_token':oauth_token,'oauth_verifier':oauth_verifier}
# print(f'Received auth token and verifier: {d}')
app.mp_queue.put(d)
return "Received auth token, you may close this window"
@app.route('/')
def default():
return "This is a temporary server"
def start_server(queue):
app.mp_queue = queue
oldstdout = sys.stdout
with open(os.devnull, 'w') as f:
sys.stdout = f
app.run()
sys.stdout = oldstdout