π tutorial de flask - 1 tutorial
π tutorial de flask - 2 tutorial
π tutorial de flask - 3 tutorial
- NOTA HACER LAS PRΓCTICAS MEDIANTE VISUAL STUDIO CODE
* Clonar el repositorio https://github.com/SocialOplesk/hack_backend_python_1.git
* Instalar las dependencias:
pip install -r requirements.txt
* Ejecutar servidor app.py en terminal: flask run --debug
* Ejecutar test a nivel global en terminal: pytest -v
* Ejecutar test por cada hack en terminal: pytest -v test_server.py::test_hack_1
* Debes tener en ejecuciΓ³n el servidor app.py para ejecutar correctamente el testing
Hacks
Details
H-1
{'payload':'success'}
H-2
{'payload':'success'}
H-3
{'payload':'success'}
H-4
{'payload':'success'}
H-5
{'payload':[]}
H-6
{'payload': {'email':email,'name': name}}
H-7
{'payload': {'email':email,'name':name,'id':id,}}
H-8
{'payload': {'email':email,'name':name,'id':id,}}
π H-1
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "GET"
ENDPOINT:("/users")
METHOD: "GET"
TYPE: JSON
output => {'payload':'success'}
π H-2
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "POST"
ENDPOINT:("/user")
METHOD: "POST"
TYPE: JSON
output => {'payload':'success'}
π H-3
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "DELETE"
ENDPOINT:("/user")
METHOD: "DELETE"
TYPE: JSON
output => {'payload':'success'}
π H-4
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "PUT"
ENDPOINT:("/user")
METHOD: "PUT"
TYPE: JSON
output => {'payload':'success'}
π H-5
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "GET"
ENDPOINT:("/api/v1/users")
METHOD: "GET"
TYPE: JSON
output => {'payload':[]}
π H-6
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "POST"
ENDPOINT:("/api/v1/user")
METHOD: "POST"
TYPE: JSON
INPUT: http://localhost:5000/api/v1/user?[email protected]&name=fooziman
output => {
'payload': {
'email':email,
'name':name,
}
}
π H-7
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "POST"
ENDPOINT:("/api/v1/user/add")
METHOD: "POST"
TYPE: JSON
INPUT: "request.form.get('key')"
output => {
'payload': {
'email':email,
'name':name,
'id':id,
}
}
π H-8
CREATE AN ENDPOINT THAT RESPONDS IF THE REQUEST IS OF TYPE "POST"
ENDPOINT:("/api/v1/user/create")
METHOD: "POST"
TYPE: JSON
INPUT: "request.get_json()"
output => {
'payload': {
'email':email,
'name':name,
'id':id,
}
}