-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
27 lines (21 loc) · 764 Bytes
/
server.py
File metadata and controls
27 lines (21 loc) · 764 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
from flask import Flask, jsonify, request
from github2s import github2sCode
# Initialize the Flask app
app = Flask(__name__)
# Define the first route for a GET request
@app.route('/github2sRequest', methods=['GET'])
def github2s_request():
# Extract parameters from the request body as JSON
data = request.get_json()
print(data)
# Process the parameters using the github2sCode function
result = github2sCode(data)
# Return the result as a JSON response
return jsonify({'result': result})
# Define the second route for a GET request
@app.route('/status', methods=['GET'])
def status():
return jsonify({'status': 'Server is running'})
# Run the Flask server
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0')