yuripeyamashita commited on
Commit
ee3e7dd
1 Parent(s): 94a125f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -4,22 +4,22 @@ import requests
4
 
5
  app = Flask(__name__)
6
 
7
- serverToken = os.environ.get("serverToken")
8
  headers = {'Authorization': os.environ.get("auth")}
9
 
10
- reqList = {}
11
 
12
- @app.route('/server', methods=['POST'])
13
- def server():
14
- if request.json.get('serverToken') != serverToken:
15
  return {}, 400
16
- token = request.json.get('token')
17
  URL = request.json.get('URL')
18
- postData = request.json.get('postData')
19
- reqList[token] = { 'URL': URL, 'postData': json.loads(postData) }
20
- print(reqList[token])
21
- return { 'success': True }, 200
22
-
23
 
24
  @app.route('/client', methods=['POST'])
25
  def client():
 
4
 
5
  app = Flask(__name__)
6
 
7
+ secret = os.environ.get("secret")
8
  headers = {'Authorization': os.environ.get("auth")}
9
 
10
+ res = {}
11
 
12
+ @app.route('/queue', methods=['POST'])
13
+ def queue():
14
+ if request.json.get('secret') != secret:
15
  return {}, 400
16
+ uuid = request.json.get('uuid')
17
  URL = request.json.get('URL')
18
+ body = request.json.get('body')
19
+ response = requests.post(URL, json=body)
20
+ res[uuid] = response
21
+ print(res[uuid])
22
+ return response, 200
23
 
24
  @app.route('/client', methods=['POST'])
25
  def client():