File size: 970 Bytes
bf00a95 94a125f 074798d 822d179 27407e5 15833f6 074798d 27407e5 822d179 27407e5 94a125f 0944f4f fabdd78 822d179 4bc235e 27407e5 0944f4f 27407e5 4bc235e 27407e5 |
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 30 31 32 33 34 35 36 37 38 39 |
from flask import Flask, request
import os, json
import requests
app = Flask(__name__)
serverToken = os.environ.get("serverToken")
headers = {'Authorization': os.environ.get("auth")}
reqList = {}
@app.route('/server', methods=['POST'])
def server():
if request.json.get('serverToken') != serverToken:
return {}, 400
token = request.json.get('token')
URL = request.json.get('URL')
postData = request.json.get('postData')
reqList[token] = { 'URL': URL, 'postData': json.loads(postData) }
print(reqList[token])
return { 'success': True }, 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) |