-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.py
37 lines (29 loc) · 863 Bytes
/
server.py
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
from flask import Flask, request
import requests
import sys
import os
app = Flask(__name__)
@app.route("/")
def root():
sys.stdout.write('\n')
return "Click [Logs] to see spans!"
@app.route("/fib")
@app.route("/fibInternal")
def fibHandler():
value = int(request.args.get('i'))
returnValue = 0
if value <= 1:
returnValue = 0
elif value == 2:
returnValue = 1
else:
minusOnePayload = {'i': value - 1}
minusTwoPayload = {'i': value - 2 }
respOne = requests.get('http://127.0.0.1:5000/fibInternal', minusOnePayload)
respTwo = requests.get('http://127.0.0.1:5000/fibInternal', minusTwoPayload)
returnValue = int(respOne.content) + int(respTwo.content)
# this is a workaround for a glitch logging issue
sys.stdout.write('\n')
return str(returnValue)
if __name__ == "__main__":
app.run(debug=True)