|
from flask import Flask, request |
|
import os, json |
|
import requests |
|
|
|
app = Flask(__name__) |
|
|
|
secret = os.environ.get("secret") |
|
headers = {'Authorization': os.environ.get("auth")} |
|
|
|
res = {} |
|
|
|
@app.route('/queue', methods=['POST']) |
|
def queue(): |
|
if request.json.get('secret') != secret: |
|
return {}, 400 |
|
uuid = request.json.get('uuid') |
|
URL = request.json.get('URL') |
|
body = request.json.get('body') |
|
response = requests.post(URL, json=body) |
|
res[uuid] = response |
|
print(res[uuid]) |
|
return response, 200 |
|
|
|
@app.route('/client', methods=['POST']) |
|
def client(): |
|
token = request.json.get('token') |
|
data = reqList.get(token) |
|
if not data: |
|
return {}, 400 |
|
print(data) |
|
URL = data.get('URL') |
|
postData = data.get('postData') |
|
|
|
response = requests.post(URL, json=postData) |
|
|
|
return response.json() |
|
|
|
if __name__ == "__main__": |
|
app.run(host="0.0.0.0", port=7860) |