Skip to content

Commit 1ebfbce

Browse files
committed
removed pandas import
1 parent 5af68c2 commit 1ebfbce

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

lab_04/example.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from flask import Flask, request
2+
3+
app = Flask(__name__)
4+
5+
# hello world
6+
@app.route("/")
7+
def hello_world():
8+
"""Return a friendly HTTP greeting."""
9+
10+
return "<p>Hello, World!</p>"
11+
12+
@app.route("/sum", methods=["GET"])
13+
def sum():
14+
"""Return the sum of two numbers."""
15+
16+
a = request.args.get("a")
17+
b = request.args.get("b")
18+
19+
return str( int(a) + int(b))
20+
21+
if __name__ == "__main__":
22+
app.run(debug=True)
23+

lab_04/example_documentation.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Example API Documentation
2+
3+
## Connecting to the API
4+
Since we are running our API locally we will access the endpoint at ```http://127.0.0.1:5000``` (or the address the appears on your console).
5+
6+
## Welcome
7+
- Method: GET
8+
- Path: ```/```
9+
- Query parameters: None
10+
11+
This is just a friendly welcome to the API.
12+
13+
## Sum
14+
- Method: GET
15+
- Path: ```/sum```
16+
- Query parameters: two integers ```a``` and ```b```
17+
18+
This query returns the sum of the two numbers in json format.
19+
20+
## Factorial
21+
- Method: GET
22+
- Path: ```/factorial```
23+
- Query parameters: An integer number ```n```
24+
25+
This query display a message with the result of n!. If no number is provided, it takes ```n = 10``` by default.

lab_04/flask_example_1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from flask import Flask, jsonify, request
2-
import pandas as pd
32

43
app = Flask(__name__)
54

lab_04/flask_lab_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def hello_world():
1111

1212

1313
@app.get("/api/list")
14-
def list_2():
14+
def list():
1515
format = request.args.get('format', 'json')
1616
filterby = request.args.get('filterby',None)
1717
filtervalue = request.args.get('filtervalue',None)

0 commit comments

Comments
 (0)