-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinicio.py
More file actions
29 lines (23 loc) · 760 Bytes
/
Copy pathinicio.py
File metadata and controls
29 lines (23 loc) · 760 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
28
29
import math
from flask import Flask
from markupsafe import escape
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
@app.route("/suma/<int:digito1>/<int:digito2>")
def suma(digito1,digito2):
valor = digito1+digito2
return f'Suma de {digito1} y {digito2} es {digito1+digito2} y {str(math.pi)}'
@app.route('/user/<username>')
def show_user_profile(username):
# show the user profile for that user
return f'User {username}'
@app.route('/post/<int:post_id>')
def show_post(post_id):
# show the post with the given id, the id is an integer
return f'Post {post_id}'
@app.route('/path/<path:subpath>')
def show_subpath(subpath):
# show the subpath after /path/
return f'Subpath {subpath}'