From 9082c9ec8aec7ceafe762cb5aa62cc66aa26b14a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Tue, 27 Feb 2024 01:28:08 -0500
Subject: [PATCH 01/27] Update devcontainer.json
---
.devcontainer/devcontainer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 6ffab33..d653790 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -21,7 +21,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.20 -g && learnpack plugins:install @learnpack/python@1.0.0"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.35 -g && learnpack plugins:install @learnpack/python@1.0.0"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
From 06a6cbae4cf20f6a2783e51c94448e244755f252 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Tue, 27 Feb 2024 01:28:40 -0500
Subject: [PATCH 02/27] Update learn.json
---
learn.json | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/learn.json b/learn.json
index 02512d3..671213e 100644
--- a/learn.json
+++ b/learn.json
@@ -19,7 +19,6 @@
"autoPlay": true,
"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
"editor": {
- "version": "1.0.73"
+ "version": "3.1.6"
}
-
}
From 69be5d6d287bd3f317800edcef8c88356f06fc3d Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Wed, 20 Mar 2024 18:25:08 +0100
Subject: [PATCH 03/27] Update README.es.md
---
README.es.md | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/README.es.md b/README.es.md
index 71e28a3..910aadb 100644
--- a/README.es.md
+++ b/README.es.md
@@ -1,14 +1,14 @@
# 🐍 Tutorial y Ejercicios de Python API Requests
-Por @alesanchezr y otros contribuidores at 4Geeks Academy
+Por @alesanchezr y otros contribuidores de 4Geeks Academy
-En esta serie, aprenderás HTTP y cómo usar el package requests de Python para crear solicitudes HTTP GET, POST, PUT, DELETE.
+En esta serie, aprenderás HTTP (*Hypertext Transfer Protocol*) y cómo usar el **package requests** de Python para crear solicitudes HTTP GET, POST, PUT, DELETE.
Todo el tutorial es 👆 interactivo, ✅ calificado automáticamente y con 📹 videos tutoriales.
-Estos Ejercicios son colaborativos, ¡te necesitamos! Si encuentras algún error o falta de ortografía, por favor contribuye y repórtalo.
+Estos ejercicios son colaborativos, ¡te necesitamos! Si encuentras algún error o falta de ortografía, por favor contribuye y repórtalo.
@@ -16,29 +16,20 @@ Estos Ejercicios son colaborativos, ¡te necesitamos! Si encuentras algún error
Puedes empezar estos ejercicios en pocos segundos haciendo clic en: [Abrir en Codespaces](https://codespaces.new/?repo=4GeeksAcademy/python-http-requests-api-tutorial-exercises) (recomendado) o [Abrir en Gitpod](https://gitpod.io#https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises).
-> Una vez ya tengas abirto VSCode los ejercicios de LearnPack deberían empezar automáticamente, si esto no sucede puedes intentar empezar los ejercicios escribiendo este comando en tu terminal: `$ learnpack start`
+> Una vez ya tengas abierto VSCode los ejercicios de LearnPack deberían empezar automáticamente, si esto no sucede puedes intentar empezar los ejercicios escribiendo este comando en tu terminal: `$ learnpack start`
### Instalación local:
Clona el repositorio en tu ambiente local y sigue los siguientes pasos:
-1. Instala learnpack, el administrador de paquetes para tutoriales de aprendizaje y el complemento del compilador html para learnpack, asegúrate de tener también node.js 14+:
+1. Asegúrate de instalar LearnPack, node.js versión 14+ y Python versión 3+. Este es el comando para instalar LearnPack:
```bash
$ npm i learnpack -g
$ learnpack plugins:install learnpack-python
```
-2. Descarga este ejercicio en particular usando learnpack y `cd` para entrar en la carpeta:
-
-```bash
-$ learnpack download python-http-requests-api-tutorial-exercises
-$ cd python-http-requests-api-tutorial-exercises
-```
-
-> Nota: Una vez que termine de descargar, encontrarás la carpeta "exercises" que contiene todos los ejercicios.
-
-3. Comienza con los ejercicios ejecutando el siguiente en el mismo nivel que tu archivo learn.json:
+2. Comienza con los ejercicios ejecutando el siguiente comando en el mismo nivel que tu archivo `learn.json`:
```bash
$ pip install pytest==4.4.2 mock pytest-testdox
@@ -50,20 +41,20 @@ $ learnpack start
Cada ejercicio es un pequeño proyecto en Python que contiene los siguientes archivos:
-1. **app.py:** representa el archivo de entrada de python que será ejecutado en el computador.
+1. **app.py:** representa el archivo de entrada de Python que será ejecutado en el computador.
2. **README.md:** contiene las instrucciones del ejercicio.
3. **test.py:** no tienes que abrir este archivo. Contiene los scripts de pruebas del ejercicio.
-> Nota: Estos ejercicios tienen calificación automática pero es un tanto rígida, te recomiendo ignorar los tests, considéralos como una recomendación o podrías frustrarte.
+> Nota: Estos ejercicios tienen calificación automática. Los tests son muy rígidos y estrictos, mi recomendación es que no prestes demasiada atención a los tests y los uses solo como una sugerencia o podrías frustrarte.
## Colaboradores
Gracias a estas personas maravillosas ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
-1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribución: (programador) 💻 (idea) 🤔, (build-tests) ⚠️ , (pull-request-review) 🤓 (build-tutorial) ✅ (documentación) 📖
+1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribución: (programador) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 👀, (build-tutorial) ✅, (documentación) 📖
-2. [Paolo (plucodev)](https://github.com/plucodev), contribución: (bug reports) 🐛, (programador), (traducción) 🌎
+2. [Paolo (plucodev)](https://github.com/plucodev), contribución: (bug reports) 🐛, (programador) 💻, (traducción) 🌎
Este proyecto sigue la especificación [all-contributors](https://github.com/kentcdodds/all-contributors). ¡Todas las contribuciones son bienvenidas!
-Este y otros ejercicios son usados para [aprender a programar](https://4geeksacademy.com/es/aprender-a-programar/aprender-a-programar-desde-cero) por parte de los alumnos de 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/us/coding-bootcamp) realizado por [Alejandro Sánchez](https://twitter.com/alesanchezr) y muchos otros contribuyentes. Conoce más sobre nuestros [Curso de Programación](https://4geeksacademy.com/es/curso-de-programacion-desde-cero?lang=es) para convertirte en [Full Stack Developer](https://4geeksacademy.com/es/coding-bootcamps/desarrollador-full-stack/?lang=es), o nuestro [Data Science Bootcamp](https://4geeksacademy.com/es/coding-bootcamps/curso-datascience-machine-learning).
+Este y otros ejercicios son usados para [aprender a programar](https://4geeksacademy.com/es/aprender-a-programar/aprender-a-programar-desde-cero) por parte de los alumnos de 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/es/inicio) realizado por [Alejandro Sánchez](https://twitter.com/alesanchezr) y muchos otros contribuyentes. Conoce más sobre nuestros [Cursos de Programación](https://4geeksacademy.com/es/curso-de-programacion-desde-cero?lang=es) para convertirte en [Full Stack Developer](https://4geeksacademy.com/es/coding-bootcamps/desarrollador-full-stack/?lang=es), o nuestro [Data Science Bootcamp](https://4geeksacademy.com/es/coding-bootcamps/curso-datascience-machine-learning).
From 99b06ebae6317cd7baeed23beeb0df884b269187 Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Wed, 20 Mar 2024 18:33:13 +0100
Subject: [PATCH 04/27] Update README.es.md
---
README.es.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.es.md b/README.es.md
index 910aadb..c541afd 100644
--- a/README.es.md
+++ b/README.es.md
@@ -22,7 +22,7 @@ Puedes empezar estos ejercicios en pocos segundos haciendo clic en: [Abrir en Co
Clona el repositorio en tu ambiente local y sigue los siguientes pasos:
-1. Asegúrate de instalar LearnPack, node.js versión 14+ y Python versión 3+. Este es el comando para instalar LearnPack:
+1. Asegúrate de instalar [LearnPack](https://www.learnpack.co/), node.js versión 14+ y Python versión 3+. Este es el comando para instalar LearnPack:
```bash
$ npm i learnpack -g
From 9128ef6577fa367498828d4120f2142f03009b01 Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Wed, 20 Mar 2024 18:34:15 +0100
Subject: [PATCH 05/27] Update README.es.md
---
README.es.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.es.md b/README.es.md
index c541afd..3a2dbe5 100644
--- a/README.es.md
+++ b/README.es.md
@@ -29,7 +29,7 @@ $ npm i learnpack -g
$ learnpack plugins:install learnpack-python
```
-2. Comienza con los ejercicios ejecutando el siguiente comando en el mismo nivel que tu archivo `learn.json`:
+2. Comienza con los ejercicios ejecutando el siguiente comando al mismo nivel que tu archivo `learn.json`:
```bash
$ pip install pytest==4.4.2 mock pytest-testdox
From e0c63f3cfcc8196dc43fbef03be78a37a854797e Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Wed, 20 Mar 2024 18:36:08 +0100
Subject: [PATCH 06/27] Update README.md
---
README.md | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index 9f0d59d..b28d3f4 100644
--- a/README.md
+++ b/README.md
@@ -7,40 +7,33 @@ By @alesanchezr and Note: The exercises have automatic grading but its very rigid and string, my recomendation is to ignore the tests and use them only as a recomendation or you can get frustrated.
+> Note: The exercises have automatic grading, but it's very rigid and strict, my recommendation is to not take the tests too serious and use them only as a suggestion, or you may get frustrated.
## Contributors
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
-1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻 (idea) 🤔, (build-tests) ⚠️ , (pull-request-review) 👀 (build-tutorial) ✅ (documentation) 📖
+1. [Alejandro Sanchez (alesanchezr)](https://github.com/alesanchezr), contribution: (coder) 💻, (idea) 🤔, (build-tests) ⚠️, (pull-request-review) 👀, (build-tutorial) ✅, (documentation) 📖
-2. [Paolo (plucodev)](https://github.com/plucodev), contribution: (bug reports) 🐛, contribution: (coder), (translation) 🌎
+2. [Paolo (plucodev)](https://github.com/plucodev), contribution: (bug reports) 🐛, contribution: (coder) 💻, (translation) 🌎
-This project follows the[all-contributors](https://github.com/kentcdodds/all-contributors) specification.Contributions of any kind are welcome!
+This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!
-This and many other exercises are built by students as part of the 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/us/coding-bootcamp) by [Alejandro Sánchez](https://twitter.com/alesanchezr) and many other contributors. Find out more about our [Full Stack Developer Course](https://4geeksacademy.com/us/coding-bootcamps/part-time-full-stack-developer), and [Data Science Bootcamp](https://4geeksacademy.com/us/coding-bootcamps/datascience-machine-learning).
\ No newline at end of file
+This and many other exercises are built by students as part of the 4Geeks Academy [Coding Bootcamp](https://4geeksacademy.com/us/coding-bootcamp) by [Alejandro Sánchez](https://twitter.com/alesanchezr) and many other contributors. Find out more about our [Full Stack Developer Course](https://4geeksacademy.com/us/coding-bootcamps/part-time-full-stack-developer), and [Data Science Bootcamp](https://4geeksacademy.com/us/coding-bootcamps/datascience-machine-learning).
From 6b1bcaad867dddd0cc8cf3ccb83c671066299b79 Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Wed, 20 Mar 2024 18:39:22 +0100
Subject: [PATCH 07/27] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index b28d3f4..4848bb7 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ $ learnpack plugins:install learnpack-python
2. Start the tutorial/exercises by running the following command at the same level your `learn.json` file is:
```bash
-$ pip install pytest==4.4.2 mock pytest-testdox
+$ pip3 install pytest==6.2.5 pytest-testdox mock requests toml
$ learnpack start
```
From b9dd88373f5ce56d5953ebb704716291d7690227 Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Wed, 20 Mar 2024 18:39:24 +0100
Subject: [PATCH 08/27] Update README.es.md
---
README.es.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.es.md b/README.es.md
index 3a2dbe5..4ba74fb 100644
--- a/README.es.md
+++ b/README.es.md
@@ -32,7 +32,7 @@ $ learnpack plugins:install learnpack-python
2. Comienza con los ejercicios ejecutando el siguiente comando al mismo nivel que tu archivo `learn.json`:
```bash
-$ pip install pytest==4.4.2 mock pytest-testdox
+$ pip3 install pytest==6.2.5 pytest-testdox mock requests toml
$ learnpack start
```
From 6b4373d1793a45b342f227f9ad29245438586abe Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Tue, 26 Mar 2024 07:19:35 +0000
Subject: [PATCH 09/27] Pending changes exported from your codespace
---
.learn/resets/03-response-body/app.py | 10 ++++++++++
.../README.es.md | 6 +++---
exercises/00-welcome/README.md | 13 ++++++++++++
exercises/01-creating-a-request/README.es.md | 20 +++++++++++++++++++
.../README.md | 10 +++++-----
.../app.py | 0
.../01-creating-a-request/solution.hide.py | 6 ++++++
.../test.py | 0
exercises/01-hello-world/README.md | 13 ------------
exercises/01-what-is-a-request/README.es.md | 20 -------------------
exercises/02-random-status/README.es.md | 11 +++++-----
exercises/02-random-status/README.md | 12 +++++------
exercises/02-random-status/solution.hide.py | 14 +++++++++++++
exercises/02-random-status/test.py | 14 ++++++++++---
exercises/03-response-body/README.es.md | 14 ++++++++-----
exercises/03-response-body/README.md | 12 +++++++----
exercises/03-response-body/app.py | 9 ++++++++-
exercises/03-response-body/solution.hide.py | 10 ++++++++++
exercises/03-response-body/test.py | 4 ++--
exercises/04-response-body-json/README.es.md | 14 ++++++-------
exercises/04-response-body-json/README.md | 12 +++++------
learn.json | 2 +-
22 files changed, 145 insertions(+), 81 deletions(-)
create mode 100644 .learn/resets/03-response-body/app.py
rename exercises/{01-hello-world => 00-welcome}/README.es.md (59%)
create mode 100644 exercises/00-welcome/README.md
create mode 100644 exercises/01-creating-a-request/README.es.md
rename exercises/{01-what-is-a-request => 01-creating-a-request}/README.md (66%)
rename exercises/{01-what-is-a-request => 01-creating-a-request}/app.py (100%)
create mode 100644 exercises/01-creating-a-request/solution.hide.py
rename exercises/{01-what-is-a-request => 01-creating-a-request}/test.py (100%)
delete mode 100644 exercises/01-hello-world/README.md
delete mode 100644 exercises/01-what-is-a-request/README.es.md
create mode 100644 exercises/02-random-status/solution.hide.py
create mode 100644 exercises/03-response-body/solution.hide.py
diff --git a/.learn/resets/03-response-body/app.py b/.learn/resets/03-response-body/app.py
new file mode 100644
index 0000000..9409dea
--- /dev/null
+++ b/.learn/resets/03-response-body/app.py
@@ -0,0 +1,10 @@
+import requests
+
+url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
+
+response = requests.get(url)
+
+if response.status_code == 200:
+ print(response.text)
+else:
+ print("Something went wrong")
\ No newline at end of file
diff --git a/exercises/01-hello-world/README.es.md b/exercises/00-welcome/README.es.md
similarity index 59%
rename from exercises/01-hello-world/README.es.md
rename to exercises/00-welcome/README.es.md
index 30f83f8..e5c364b 100644
--- a/exercises/01-hello-world/README.es.md
+++ b/exercises/00-welcome/README.es.md
@@ -1,13 +1,13 @@
-# Python API Requests
+# `00` Welcome to Python API Requests!
Python Requests es el paquete más popular para consumir API y hacer solicitudes HTTP.
Aquí aprenderás:
1. Cómo hacer solicitudes GET.
-2. Cómo obtener propiedades de una data e información.
+2. Cómo obtener propiedades de datos e información.
3. Cómo configurar request headers.
4. Cómo configurar request content-type.
5. Cómo hacer solicitudes POST.
-Haga click en el botón `next →` en la esquina superior derecha para continuar.
\ No newline at end of file
+Haga clic en el botón `Next →` en la esquina superior derecha para continuar.
\ No newline at end of file
diff --git a/exercises/00-welcome/README.md b/exercises/00-welcome/README.md
new file mode 100644
index 0000000..580410c
--- /dev/null
+++ b/exercises/00-welcome/README.md
@@ -0,0 +1,13 @@
+# `00` Welcome to Python API Requests!
+
+Python Requests is the most popular package for consuming APIs and doing HTTP requests.
+
+Here you will learn:
+
+1. How to do GET requests.
+2. How to fetch data properties and information.
+3. How to set request headers.
+4. How to set request content-type.
+5. How to do POST requests.
+
+Click the `Next →` button on the top right to continue.
\ No newline at end of file
diff --git a/exercises/01-creating-a-request/README.es.md b/exercises/01-creating-a-request/README.es.md
new file mode 100644
index 0000000..652d819
--- /dev/null
+++ b/exercises/01-creating-a-request/README.es.md
@@ -0,0 +1,20 @@
+# `01` Creating a Request
+
+Python tiene integrado un [paquete de solicitudes (*requests package*)](https://requests.readthedocs.io/en/master/) eso permite a los desarrolladores crear solicitudes HTTP con bastante facilidad.
+
+Así es como en Python hacemos una solicitud HTTP GET:
+
+```python
+response = requests.get('')
+print(response.status_code)
+```
+
+## 📝 Instrucciones:
+
+Actualiza la variable `url` para que solicite a esta dirección:
+
+```bash
+https://assets.breatheco.de/apis/fake/sample/hello.php
+```
+
+> Nota: La consola debe imprimir un código de estado 200.
\ No newline at end of file
diff --git a/exercises/01-what-is-a-request/README.md b/exercises/01-creating-a-request/README.md
similarity index 66%
rename from exercises/01-what-is-a-request/README.md
rename to exercises/01-creating-a-request/README.md
index 413bd2e..6ff6b36 100644
--- a/exercises/01-what-is-a-request/README.md
+++ b/exercises/01-creating-a-request/README.md
@@ -1,4 +1,4 @@
-# 02 Creating a request
+# `01` Creating a Request
Python has a [requests package](https://requests.readthedocs.io/en/master/) that allows developers to create HTTP request pretty easily.
@@ -9,12 +9,12 @@ response = requests.get('')
print(response.status_code)
```
-# 📝 Instructions
+## 📝 Instructions:
-Change the variable url to make it request to:
+Update the `url` variable to make it request to this address:
-```bash
+```text
https://assets.breatheco.de/apis/fake/sample/hello.php
```
-Note: The console should print a 200 status code.
\ No newline at end of file
+> Note: The console should print a 200 status code.
\ No newline at end of file
diff --git a/exercises/01-what-is-a-request/app.py b/exercises/01-creating-a-request/app.py
similarity index 100%
rename from exercises/01-what-is-a-request/app.py
rename to exercises/01-creating-a-request/app.py
diff --git a/exercises/01-creating-a-request/solution.hide.py b/exercises/01-creating-a-request/solution.hide.py
new file mode 100644
index 0000000..4834ba5
--- /dev/null
+++ b/exercises/01-creating-a-request/solution.hide.py
@@ -0,0 +1,6 @@
+import requests
+
+url = "https://assets.breatheco.de/apis/fake/sample/hello.php"
+response = requests.get(url)
+
+print("The response status is: "+str(response.status_code))
\ No newline at end of file
diff --git a/exercises/01-what-is-a-request/test.py b/exercises/01-creating-a-request/test.py
similarity index 100%
rename from exercises/01-what-is-a-request/test.py
rename to exercises/01-creating-a-request/test.py
diff --git a/exercises/01-hello-world/README.md b/exercises/01-hello-world/README.md
deleted file mode 100644
index 3cb9e7e..0000000
--- a/exercises/01-hello-world/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Python API Requests
-
-Python Requests is the most popular package for consuming API's and doing HTTP requests.
-
-Here you will learn:
-
-1. How to do GET requests.
-2. How to fech data properties and information.
-3. How to set request headers.
-4. How to set request content-type.
-5. How to do POST requests.
-
-Click the `next →` button on the top right to continue.
\ No newline at end of file
diff --git a/exercises/01-what-is-a-request/README.es.md b/exercises/01-what-is-a-request/README.es.md
deleted file mode 100644
index 408b1d2..0000000
--- a/exercises/01-what-is-a-request/README.es.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# 02 Creando una solicitud (request)
-
-Python tiene un [paquete de solicitud (requests package)](https://requests.readthedocs.io/en/master/) eso permite a los desarrolladores crear solicitudes HTTP con bastante facilidad.
-
-Así es como en Python hacemos una solicitud HTTP GET:
-
-```python
-response = requests.get('')
-print(response.status_code)
-```
-
-# 📝 Instrucciones
-
-Cambie la variable URL para que solicite:
-
-```bash
-https://assets.breatheco.de/apis/fake/sample/hello.php
-```
-
-Nota: La consola debe imprimir un código de estado 200.
\ No newline at end of file
diff --git a/exercises/02-random-status/README.es.md b/exercises/02-random-status/README.es.md
index a1a3d54..e670821 100644
--- a/exercises/02-random-status/README.es.md
+++ b/exercises/02-random-status/README.es.md
@@ -1,14 +1,15 @@
-# `02` Manejar el Status de Respuesta
+# `02` Handle Response Status
La siguiente solicitud GET siempre devuelve un código de status diferente, nunca se sabe qué respuesta está recibiendo del servidor.
-## 📝Instrucciones
+## 📝 Instrucciones:
Crea una condición para imprimir en la consola los siguientes mensajes según el status de respuesta:
-| Status | Message |
+| Status | Mensaje |
| ----- | ----- |
-| 404 | The URL you asked is not found |
+| 404 | The URL you asked for is not found |
| 503 | Unavailable right now |
| 200 | Everything went perfect |
-| 400 | Something is wrong on the request params |
\ No newline at end of file
+| 400 | Something is wrong with the request params |
+| Otro código de status | Unknown status code |
\ No newline at end of file
diff --git a/exercises/02-random-status/README.md b/exercises/02-random-status/README.md
index 7cbf29c..93df280 100644
--- a/exercises/02-random-status/README.md
+++ b/exercises/02-random-status/README.md
@@ -1,15 +1,15 @@
# `02` Handle Response Status
-The following GET request is always returning a different status code, you never know what reponse you are getting form the server.
+The following GET request is always returning a different status code; you never know what response you are getting from the server.
-## 📝Instructions
+## 📝 Instructions:
-Create a condition to print on the console the following messages depending on the response status:
+Create a condition to print on the console the following messages, depending on the response status:
| Status | Message |
| ----- | ----- |
-| 404 | The URL you asked is not found |
+| 404 | The URL you asked for is not found |
| 503 | Unavailable right now |
| 200 | Everything went perfect |
-| 400 | Something is wrong on the request params |
-| anything else | anything |
\ No newline at end of file
+| 400 | Something is wrong with the request params |
+| Any other code | Unknown status code |
\ No newline at end of file
diff --git a/exercises/02-random-status/solution.hide.py b/exercises/02-random-status/solution.hide.py
new file mode 100644
index 0000000..59beb63
--- /dev/null
+++ b/exercises/02-random-status/solution.hide.py
@@ -0,0 +1,14 @@
+import requests
+
+response = requests.get("https://assets.breatheco.de/apis/fake/sample/random-status.php")
+
+if response.status_code == 404:
+ print("The URL you asked for is not found")
+elif response.status_code == 503:
+ print("Unavailable right now")
+elif response.status_code == 200:
+ print("Everything went perfect")
+elif response.status_code == 400:
+ print("Something is wrong with the request params")
+else:
+ print("Unknown code")
\ No newline at end of file
diff --git a/exercises/02-random-status/test.py b/exercises/02-random-status/test.py
index e552c51..111bc00 100644
--- a/exercises/02-random-status/test.py
+++ b/exercises/02-random-status/test.py
@@ -16,7 +16,7 @@ def test_url_200(capsys, app):
captured = capsys.readouterr()
assert "Everything went perfect\n" == captured.out
-@pytest.mark.it("When testing for 404 it should print The URL you asked is not found'")
+@pytest.mark.it("Testing for 404: The URL you asked for is not found'")
def test_url_404(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value.status_code = 404
@@ -32,10 +32,18 @@ def test_url_503(capsys, app):
captured = capsys.readouterr()
assert "Unavailable right now\n" == captured.out
-@pytest.mark.it("Testing for 400: Something is wrong on the request params")
+@pytest.mark.it("Testing for 400: Something is wrong with the request params")
def test_url_400(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value.status_code = 400
app()
captured = capsys.readouterr()
- assert "Something is wrong on the request params\n" == captured.out
+ assert "Something is wrong with the request params\n" == captured.out
+
+@pytest.mark.it("Testing for any other code: Unknown status code")
+def test_url_generic_response(capsys, app):
+ with patch('requests.get') as mock_request:
+ mock_request.return_value.status_code = 500 # For example, using status code 500 for generic response
+ app()
+ captured = capsys.readouterr()
+ assert "Unknown status code\n" == captured.out
\ No newline at end of file
diff --git a/exercises/03-response-body/README.es.md b/exercises/03-response-body/README.es.md
index 8e93d07..348bb72 100644
--- a/exercises/03-response-body/README.es.md
+++ b/exercises/03-response-body/README.es.md
@@ -1,14 +1,18 @@
-# `03` Respuesta en Body
+# `03` Response Body
Haga clic en este enlace para ver la respuesta que esta solicitud GET está dando en el body:
[https://assets.breatheco.de/apis/fake/sample/random-status.php](https://assets.breatheco.de/apis/fake/sample/random-status.php)
-Ahora, si deseas obtener ese body como respuesta (texto), todo lo que tiene que hacer es:
+Ahora, si deseas obtener el *body* de la respuesta (texto/contenido), todo lo que tienes que hacer es:
+
```py
-# plain text
print(response.text)
```
-# 📝 Instrucciones
+## 📝 Instrucciones:
+
+Imprime en la consola el *body* de la respuesta solo para solicitudes con status `200`, para el resto imprime:
-Imprime en la consola la the responde body solo para solicitudes 200, para el resto imprima "Something went wrong".
\ No newline at end of file
+```text
+"Something went wrong"
+```
\ No newline at end of file
diff --git a/exercises/03-response-body/README.md b/exercises/03-response-body/README.md
index abe927f..2f7d516 100644
--- a/exercises/03-response-body/README.md
+++ b/exercises/03-response-body/README.md
@@ -3,12 +3,16 @@
Click on this link to see the response body that this GET request is giving:
[https://assets.breatheco.de/apis/fake/sample/random-status.php](https://assets.breatheco.de/apis/fake/sample/random-status.php)
-Now, if you want to get that response body (text) all you have to do is:
+Now, if you want to get that response body (text/content) all you have to do is this:
+
```py
-# plain text
print(response.text)
```
-# 📝 Instructions
+## 📝 Instructions:
+
+Print on the console the response body for status code `200`, for all the other print:
-Print on the console the response body only for 200 requests, for all the other print "Something went wrong".
\ No newline at end of file
+```text
+"Something went wrong"
+```
\ No newline at end of file
diff --git a/exercises/03-response-body/app.py b/exercises/03-response-body/app.py
index 37cdac0..9409dea 100644
--- a/exercises/03-response-body/app.py
+++ b/exercises/03-response-body/app.py
@@ -1,3 +1,10 @@
import requests
-url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
\ No newline at end of file
+url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
+
+response = requests.get(url)
+
+if response.status_code == 200:
+ print(response.text)
+else:
+ print("Something went wrong")
\ No newline at end of file
diff --git a/exercises/03-response-body/solution.hide.py b/exercises/03-response-body/solution.hide.py
new file mode 100644
index 0000000..9409dea
--- /dev/null
+++ b/exercises/03-response-body/solution.hide.py
@@ -0,0 +1,10 @@
+import requests
+
+url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
+
+response = requests.get(url)
+
+if response.status_code == 200:
+ print(response.text)
+else:
+ print("Something went wrong")
\ No newline at end of file
diff --git a/exercises/03-response-body/test.py b/exercises/03-response-body/test.py
index c138063..7dfd71a 100644
--- a/exercises/03-response-body/test.py
+++ b/exercises/03-response-body/test.py
@@ -7,7 +7,7 @@ def test_url_call(capsys, app):
app()
mock_request.assert_called_once_with("https://assets.breatheco.de/apis/fake/sample/random-status.php")
-@pytest.mark.it("Testing for 200: Everythign went perfect")
+@pytest.mark.it("Testing for 200: Everything went perfect")
def test_url_200(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value.status_code = 200
@@ -16,7 +16,7 @@ def test_url_200(capsys, app):
captured = capsys.readouterr()
assert "something\n" == captured.out
-@pytest.mark.it("When testing for 404 it should print 'Something went wrong'")
+@pytest.mark.it("Testing for any other code: Something went wrong")
def test_url_404(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value.status_code = 404
diff --git a/exercises/04-response-body-json/README.es.md b/exercises/04-response-body-json/README.es.md
index 5b00639..e5005d4 100644
--- a/exercises/04-response-body-json/README.es.md
+++ b/exercises/04-response-body-json/README.es.md
@@ -1,8 +1,8 @@
-# `04` Respuesta JSON
+# `04` Response JSON
Pero tener una respuesta basada en texto no es muy útil, es por eso que las API normalmente responden en formato CSV, JSON, YAML o XML.
-# 📝 Instrucciones
+## 📝 Instrucciones:
El siguiente endpoint devuelve la hora actual en un formato JSON cada vez que se solicita utilizando el método GET.
@@ -22,15 +22,15 @@ Response body:
}
```
-Haga una solicitud GET a ese endpoint e imprima la hora en la consola con este formato:
+Haga una solicitud GET a ese endpoint e imprime la hora en la consola con este formato:
```bash
Current time: 17 hrs 06 min and 23 sec
```
-## 💡Pista
+## 💡 Pistas:
-1. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario y almacenarlo en una variable
-2. Obtenga las propiedades `horas`,` minutos` y `segundos` del diccionario
-3. Concatenar todo de esta manera: `Hora actual: 17 h 06 min y 23 seg`
+1. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario y almacenarlo en una variable.
+2. Obtenga las propiedades `hours`, `minutes` y `seconds` del diccionario.
+3. Concatenar todo de esta manera: `Hora actual: 17 h 06 min y 23 seg`.
diff --git a/exercises/04-response-body-json/README.md b/exercises/04-response-body-json/README.md
index bdd7ddb..b8bdea5 100644
--- a/exercises/04-response-body-json/README.md
+++ b/exercises/04-response-body-json/README.md
@@ -2,7 +2,7 @@
But having a text based response is not very useful, that is why API's normally respond in CSV, JSON, YAML or XML format.
-# 📝 Instructions
+## 📝 Instructions:
The following endpoint returns the current time in a JSON format every time it is requested using the GET method.
@@ -24,13 +24,13 @@ Response body:
Please do a GET request to that endpoint and print the time on the console with this format:
-```bash
+```text
Current time: 17 hrs 06 min and 23 sec
```
-## 💡Hint
+## 💡 Hints:
-1. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary and store it in a variable
-2. Get the `hours`, `minutes` and `seconds` properties from the dictionary
-3. Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`
+1. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary and store it in a variable.
+2. Get the `hours`, `minutes` and `seconds` properties from the dictionary.
+3. Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`.
diff --git a/learn.json b/learn.json
index 02512d3..ab22723 100644
--- a/learn.json
+++ b/learn.json
@@ -6,7 +6,7 @@
},
"slug": "python-http-requests-api-tutorial-exercises",
"description": {
- "us": "Learn interactively to consume and create HTTP requests to API's using Python",
+ "us": "Learn interactively to consume and create HTTP requests to APIs using Python",
"es": "Aprende interactivamente cómo consumir APIs y hacer requests HTTP con Python"
},
"repository": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises",
From 8e299a4466b160aaa18b3f84ea19cb7b06d52fe0 Mon Sep 17 00:00:00 2001
From: josemoracard
Date: Tue, 26 Mar 2024 15:10:49 +0000
Subject: [PATCH 10/27] exercises, .gitignore, solutions, tests
---
.gitignore | 1 +
.learn/resets/03-response-body/app.py | 10 ------
exercises/00-welcome/README.es.md | 2 +-
exercises/02-random-status/solution.hide.py | 2 +-
exercises/02-random-status/test.py | 2 +-
exercises/03-response-body/app.py | 7 ----
exercises/03-response-body/test.py | 2 +-
exercises/04-response-body-json/README.es.md | 8 ++---
exercises/04-response-body-json/README.md | 10 +++---
.../04-response-body-json/solution.hide.py | 16 ++++++++++
exercises/04-response-body-json/test.py | 2 +-
exercises/05-project-name/README.es.md | 22 ++++++-------
exercises/05-project-name/README.md | 18 +++++------
exercises/05-project-name/app.py | 2 +-
exercises/05-project-name/solution.hide.py | 15 +++++++++
exercises/05-project-name/test.py | 7 ++--
exercises/06-project-list/README.es.md | 32 ++++++++++---------
exercises/06-project-list/README.md | 27 ++++++++--------
exercises/06-project-list/app.py | 2 +-
exercises/06-project-list/solution.hide.py | 15 +++++++++
exercises/06-project-list/test.py | 14 ++++----
exercises/07-project-list-image/README.es.md | 23 ++++++-------
exercises/07-project-list-image/README.md | 21 ++++++------
exercises/07-project-list-image/app.py | 2 +-
.../07-project-list-image/solution.hide.py | 19 +++++++++++
exercises/07-project-list-image/test.py | 6 ++--
exercises/08-blog-post-author/README.es.md | 26 ++++++++-------
exercises/08-blog-post-author/README.md | 20 ++++++------
exercises/08-blog-post-author/app.py | 2 +-
.../08-blog-post-author/solution.hide.py | 21 ++++++++++++
exercises/08-blog-post-author/test.py | 2 +-
.../09-array-of-blog-titles/README.es.md | 20 ------------
exercises/09-array-of-blog-titles/README.md | 21 ------------
exercises/09-list-of-blog-titles/README.es.md | 20 ++++++++++++
exercises/09-list-of-blog-titles/README.md | 21 ++++++++++++
.../app.py | 2 +-
.../09-list-of-blog-titles/solution.hide.py | 25 +++++++++++++++
.../test.py | 8 ++---
exercises/10-get-post-tags/README.es.md | 14 ++++++++
exercises/10-get-post-tags/README.md | 14 ++++++++
.../app.py | 2 +-
exercises/10-get-post-tags/solution.hide.py | 23 +++++++++++++
.../test.py | 0
exercises/10-get_post_tags/README.es.md | 14 --------
exercises/10-get_post_tags/README.md | 14 --------
.../11-get-attachment-by-id/README.es.md | 13 ++++++++
exercises/11-get-attachment-by-id/README.md | 13 ++++++++
.../app.py | 2 +-
.../11-get-attachment-by-id/solution.hide.py | 25 +++++++++++++++
.../test.py | 16 +++++-----
.../11-get_attachment_by_id/README.es.md | 13 --------
exercises/11-get_attachment_by_id/README.md | 13 --------
exercises/12-post-request/README.es.md | 17 +++++-----
exercises/12-post-request/README.md | 15 ++++-----
exercises/12-post-request/app.py | 2 +-
exercises/12-post-request/solution.hide.py | 8 +++++
exercises/12-post-request/test.py | 2 +-
exercises/13-post-request-body/README.es.md | 19 +++++------
exercises/13-post-request-body/README.md | 19 +++++------
exercises/13-post-request-body/app.py | 4 +--
.../13-post-request-body/solution.hide.py | 18 +++++++++++
exercises/13-post-request-body/test.py | 4 +--
62 files changed, 468 insertions(+), 291 deletions(-)
delete mode 100644 .learn/resets/03-response-body/app.py
create mode 100644 exercises/04-response-body-json/solution.hide.py
create mode 100644 exercises/05-project-name/solution.hide.py
create mode 100644 exercises/06-project-list/solution.hide.py
create mode 100644 exercises/07-project-list-image/solution.hide.py
create mode 100644 exercises/08-blog-post-author/solution.hide.py
delete mode 100644 exercises/09-array-of-blog-titles/README.es.md
delete mode 100644 exercises/09-array-of-blog-titles/README.md
create mode 100644 exercises/09-list-of-blog-titles/README.es.md
create mode 100644 exercises/09-list-of-blog-titles/README.md
rename exercises/{09-array-of-blog-titles => 09-list-of-blog-titles}/app.py (77%)
create mode 100644 exercises/09-list-of-blog-titles/solution.hide.py
rename exercises/{09-array-of-blog-titles => 09-list-of-blog-titles}/test.py (80%)
create mode 100644 exercises/10-get-post-tags/README.es.md
create mode 100644 exercises/10-get-post-tags/README.md
rename exercises/{10-get_post_tags => 10-get-post-tags}/app.py (80%)
create mode 100644 exercises/10-get-post-tags/solution.hide.py
rename exercises/{10-get_post_tags => 10-get-post-tags}/test.py (100%)
delete mode 100644 exercises/10-get_post_tags/README.es.md
delete mode 100644 exercises/10-get_post_tags/README.md
create mode 100644 exercises/11-get-attachment-by-id/README.es.md
create mode 100644 exercises/11-get-attachment-by-id/README.md
rename exercises/{11-get_attachment_by_id => 11-get-attachment-by-id}/app.py (83%)
create mode 100644 exercises/11-get-attachment-by-id/solution.hide.py
rename exercises/{11-get_attachment_by_id => 11-get-attachment-by-id}/test.py (63%)
delete mode 100644 exercises/11-get_attachment_by_id/README.es.md
delete mode 100644 exercises/11-get_attachment_by_id/README.md
create mode 100644 exercises/12-post-request/solution.hide.py
create mode 100644 exercises/13-post-request-body/solution.hide.py
diff --git a/.gitignore b/.gitignore
index 4598f93..54245b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
!/exercises
!/exercises/*
+exercises/*/__pycache__/
!/.learn
/.learn/**
diff --git a/.learn/resets/03-response-body/app.py b/.learn/resets/03-response-body/app.py
deleted file mode 100644
index 9409dea..0000000
--- a/.learn/resets/03-response-body/app.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import requests
-
-url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
-
-response = requests.get(url)
-
-if response.status_code == 200:
- print(response.text)
-else:
- print("Something went wrong")
\ No newline at end of file
diff --git a/exercises/00-welcome/README.es.md b/exercises/00-welcome/README.es.md
index e5c364b..9c91a02 100644
--- a/exercises/00-welcome/README.es.md
+++ b/exercises/00-welcome/README.es.md
@@ -1,6 +1,6 @@
# `00` Welcome to Python API Requests!
-Python Requests es el paquete más popular para consumir API y hacer solicitudes HTTP.
+Python Requests es el paquete más popular para consumir APIs y hacer solicitudes HTTP.
Aquí aprenderás:
diff --git a/exercises/02-random-status/solution.hide.py b/exercises/02-random-status/solution.hide.py
index 59beb63..c5f53cb 100644
--- a/exercises/02-random-status/solution.hide.py
+++ b/exercises/02-random-status/solution.hide.py
@@ -11,4 +11,4 @@
elif response.status_code == 400:
print("Something is wrong with the request params")
else:
- print("Unknown code")
\ No newline at end of file
+ print("Unknown status code")
\ No newline at end of file
diff --git a/exercises/02-random-status/test.py b/exercises/02-random-status/test.py
index 111bc00..9e774ac 100644
--- a/exercises/02-random-status/test.py
+++ b/exercises/02-random-status/test.py
@@ -22,7 +22,7 @@ def test_url_404(capsys, app):
mock_request.return_value.status_code = 404
app()
captured = capsys.readouterr()
- assert "The URL you asked is not found\n" == captured.out
+ assert "The URL you asked for is not found\n" == captured.out
@pytest.mark.it("Testing for 503: Unavailable right now")
def test_url_503(capsys, app):
diff --git a/exercises/03-response-body/app.py b/exercises/03-response-body/app.py
index 9409dea..66b2f6b 100644
--- a/exercises/03-response-body/app.py
+++ b/exercises/03-response-body/app.py
@@ -1,10 +1,3 @@
import requests
url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
-
-response = requests.get(url)
-
-if response.status_code == 200:
- print(response.text)
-else:
- print("Something went wrong")
\ No newline at end of file
diff --git a/exercises/03-response-body/test.py b/exercises/03-response-body/test.py
index 7dfd71a..09972c4 100644
--- a/exercises/03-response-body/test.py
+++ b/exercises/03-response-body/test.py
@@ -7,7 +7,7 @@ def test_url_call(capsys, app):
app()
mock_request.assert_called_once_with("https://assets.breatheco.de/apis/fake/sample/random-status.php")
-@pytest.mark.it("Testing for 200: Everything went perfect")
+@pytest.mark.it("Testing for 200: Ok")
def test_url_200(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value.status_code = 200
diff --git a/exercises/04-response-body-json/README.es.md b/exercises/04-response-body-json/README.es.md
index e5005d4..600a412 100644
--- a/exercises/04-response-body-json/README.es.md
+++ b/exercises/04-response-body-json/README.es.md
@@ -22,7 +22,7 @@ Response body:
}
```
-Haga una solicitud GET a ese endpoint e imprime la hora en la consola con este formato:
+1. Haz una solicitud GET a ese endpoint e imprime la hora en la consola con este formato:
```bash
Current time: 17 hrs 06 min and 23 sec
@@ -30,7 +30,7 @@ Current time: 17 hrs 06 min and 23 sec
## 💡 Pistas:
-1. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario y almacenarlo en una variable.
-2. Obtenga las propiedades `hours`, `minutes` y `seconds` del diccionario.
-3. Concatenar todo de esta manera: `Hora actual: 17 h 06 min y 23 seg`.
++ Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario y almacenarlo en una variable.
++ Obtenga las propiedades `hours`, `minutes` y `seconds` del diccionario.
++ Concatenar todo de esta manera: `Hora actual: 17 h 06 min y 23 seg`.
diff --git a/exercises/04-response-body-json/README.md b/exercises/04-response-body-json/README.md
index b8bdea5..5e7e6db 100644
--- a/exercises/04-response-body-json/README.md
+++ b/exercises/04-response-body-json/README.md
@@ -1,6 +1,6 @@
# `04` Response JSON
-But having a text based response is not very useful, that is why API's normally respond in CSV, JSON, YAML or XML format.
+But having a text based response is not very useful, that is why APIs normally respond in CSV, JSON, YAML or XML format.
## 📝 Instructions:
@@ -22,7 +22,7 @@ Response body:
}
```
-Please do a GET request to that endpoint and print the time on the console with this format:
+1. Please do a GET request to that endpoint and print the time on the console with this format:
```text
Current time: 17 hrs 06 min and 23 sec
@@ -30,7 +30,7 @@ Current time: 17 hrs 06 min and 23 sec
## 💡 Hints:
-1. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary and store it in a variable.
-2. Get the `hours`, `minutes` and `seconds` properties from the dictionary.
-3. Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`.
++ Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary and store it in a variable.
++ Get the `hours`, `minutes` and `seconds` properties from the dictionary.
++ Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`.
diff --git a/exercises/04-response-body-json/solution.hide.py b/exercises/04-response-body-json/solution.hide.py
new file mode 100644
index 0000000..cc2f069
--- /dev/null
+++ b/exercises/04-response-body-json/solution.hide.py
@@ -0,0 +1,16 @@
+import requests
+
+response = requests.get("https://assets.breatheco.de/apis/fake/sample/time.php")
+
+if response.status_code == 200:
+ # Parsing JSON response
+ time_data = response.json()
+
+ # Extracting hours, minutes, and seconds
+ hours = time_data["hours"]
+ minutes = time_data["minutes"]
+ seconds = time_data["seconds"]
+
+ print(f"Current time: {hours} hrs {minutes} min and {seconds} sec")
+else:
+ print("Failed to fetch current time.")
\ No newline at end of file
diff --git a/exercises/04-response-body-json/test.py b/exercises/04-response-body-json/test.py
index 28031b9..a057d36 100644
--- a/exercises/04-response-body-json/test.py
+++ b/exercises/04-response-body-json/test.py
@@ -14,7 +14,7 @@ def test_url_call(capsys, app):
app()
mock_request.assert_called_once_with("https://assets.breatheco.de/apis/fake/sample/time.php")
-@pytest.mark.it("You should print on the console a stirng like: Current time: 19 hrs 45 min and 06 sec")
+@pytest.mark.it("You should print on the console a string like: Current time: 19 hrs 45 min and 06 sec")
def test_url_output(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value = FakeResponse()
diff --git a/exercises/05-project-name/README.es.md b/exercises/05-project-name/README.es.md
index 65ddfed..002f6e1 100644
--- a/exercises/05-project-name/README.es.md
+++ b/exercises/05-project-name/README.es.md
@@ -1,4 +1,4 @@
-# `05` Nombre de Proyecto
+# `05` Project name
El siguiente endpoint es ideal para recuperar proyectos de estudiantes:
@@ -8,7 +8,7 @@ GET [https://assets.breatheco.de/apis/fake/sample/project1.php](https://assets.b
{
"name": "Coursera eLearning",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "The coolest eLearning site on the planet",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -18,19 +18,19 @@ GET [https://assets.breatheco.de/apis/fake/sample/project1.php](https://assets.b
}
```
-# 📝 Instrucciones
+## 📝 Instrucciones:
-Llama al endpoint e imprime el nombre del proyecto en el terminal (solo el nombre del proyecto)
+1. Llama al endpoint e imprime el nombre del proyecto en el terminal (solo el nombre del proyecto).
-Example output:
-```bash
+Ejemplo de salida:
+
+```text
Coursera eLearning
```
-## 💡Pista
+## 💡 Pistas:
-1. Ejercicio similar al anterior.
-2. Haz una solicitud GET al endpoint.
-3. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario (igual que lo hizo en el último ejercicio).
-4. Imprime el nombre del proyecto, puedes acceder al nombre de la propiedad en el diccionario de respuestas.
++ Haz una solicitud GET al endpoint.
++ Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario (igual que en el último ejercicio).
++ Imprime el nombre del proyecto, puedes acceder al nombre de la propiedad en el diccionario de respuestas.
diff --git a/exercises/05-project-name/README.md b/exercises/05-project-name/README.md
index 2543185..7731838 100644
--- a/exercises/05-project-name/README.md
+++ b/exercises/05-project-name/README.md
@@ -8,7 +8,7 @@ GET [https://assets.breatheco.de/apis/fake/sample/project1.php](https://assets.b
{
"name": "Coursera eLearning",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "The coolest eLearning site on the planet",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -18,19 +18,19 @@ GET [https://assets.breatheco.de/apis/fake/sample/project1.php](https://assets.b
}
```
-# 📝 Instructions
+## 📝 Instructions:
-Please call the endpoint and print the project name on the terminal (only the project name)
+1. Please call the endpoint and print the project name on the terminal (only the project name).
Example output:
-```bash
+
+```text
Coursera eLearning
```
-## 💡Hint
+## 💡 Hints:
-1. Similar exercise to the previous one.
-2. Do a GET request to the endpoint.
-3. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary (same as you did on last exercise).
-4. Print the project name, you can access the property name on the response dictionary.
++ Make a GET request to the endpoint.
++ Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary (same as you did on the last exercise).
++ Print the project name; you can access the property name in the response dictionary.
diff --git a/exercises/05-project-name/app.py b/exercises/05-project-name/app.py
index a471294..0ca5c86 100644
--- a/exercises/05-project-name/app.py
+++ b/exercises/05-project-name/app.py
@@ -1,3 +1,3 @@
import requests
-# your code here
\ No newline at end of file
+# Your code here
\ No newline at end of file
diff --git a/exercises/05-project-name/solution.hide.py b/exercises/05-project-name/solution.hide.py
new file mode 100644
index 0000000..c840be4
--- /dev/null
+++ b/exercises/05-project-name/solution.hide.py
@@ -0,0 +1,15 @@
+import requests
+
+# Your code here
+response = requests.get("https://assets.breatheco.de/apis/fake/sample/project1.php")
+
+if response.status_code == 200:
+ # Parsing JSON response
+ project_data = response.json()
+
+ # Extracting project name
+ project_name = project_data["name"]
+
+ print(project_name)
+else:
+ print("Failed to fetch project data.")
\ No newline at end of file
diff --git a/exercises/05-project-name/test.py b/exercises/05-project-name/test.py
index e95a4da..1256d31 100644
--- a/exercises/05-project-name/test.py
+++ b/exercises/05-project-name/test.py
@@ -8,7 +8,7 @@ def json(self):
return {
"name": "Sample Project",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "The coolest eLearning site on the planet",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -17,13 +17,14 @@ def json(self):
]
}
-@pytest.mark.it("requests.get has to be called to the project url")
+@pytest.mark.it("requests.get has to be called for the project.php url")
def test_url_call(capsys, app):
with patch('requests.get') as mock_request:
app()
mock_request.assert_called_once_with("https://assets.breatheco.de/apis/fake/sample/project1.php")
-@pytest.mark.it("You should print on the console a stirng like: Current time: 19 hrs 45 min and 06 sec")
+
+@pytest.mark.it("You should print the name of the project on the console")
def test_url_output(capsys, app):
with patch('requests.get') as mock_request:
mock_request.return_value = FakeResponse()
diff --git a/exercises/06-project-list/README.es.md b/exercises/06-project-list/README.es.md
index 0850906..d54db13 100644
--- a/exercises/06-project-list/README.es.md
+++ b/exercises/06-project-list/README.es.md
@@ -1,15 +1,16 @@
-# `06` Lista de Proyectos
+# `06` Project List
-El siguiente endpoint devuelve una respuesta con formato JSON con varios proyectos en una lista:
+El siguiente endpoint devuelve una respuesta en formato JSON con varios proyectos en una lista:
GET: [https://assets.breatheco.de/apis/fake/sample/project_list.php](https://assets.breatheco.de/apis/fake/sample/project_list.php)
Cada uno de los proyectos tiene el siguiente formato (ejemplo):
+
```json
{
"name": "Coursera eLearning",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "The coolest eLearning site on the planet",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -19,22 +20,23 @@ Cada uno de los proyectos tiene el siguiente formato (ejemplo):
}
```
-# 📝 Instrucciones
+## 📝 Instrucciones:
+
+1. Llama al endpoint e imprime el nombre del **SEGUNDO** proyecto en la lista:
-Llame al punto final e imprima el nombre del **SEGUNDO** proyecto en la lista:
+Ejemplo de salida:
-Ejemplo:
-```bash
+```text
Coursera eLearning
```
-## 💡Pista
+## 💡 Pistas:
-1. Abre el endpoint en tu navegador y analiza la respuesta que se encuentra en el body, necesitas saber qué esperar, cuál será la estructura de los datos (body response) que regresan del servidor.
-2. En este caso, el body response comienza con un corchete `[`, es una lista, debe acceder al segundo proyecto utilizando posiciones numéricas.
-2. Haga una solicitud GET al endpoint.
-3. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp)para obtener el body response como un diccionario.
-4. Encuentra el segundo proyecto
-5. Imprime el nombre del proyecto, puedes acceder a la propiedad nombre "name" del diccionario del proyecto.
-6. No necesitas hacer un bucle (loop), solo accede al segundo elemento como una lista usando la posición
++ Abre el endpoint en tu navegador y analiza la respuesta que se encuentra en el body, necesitas saber qué esperar, cuál será la estructura de los datos (response body) que devuelve el servidor.
++ En este caso, el response body comienza con un corchete `[`, es una lista, debes acceder al segundo proyecto utilizando posiciones numéricas.
++ Haz una solicitud GET al endpoint.
++ Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario.
++ Encuentra el segundo proyecto de la lista.
++ Imprime el nombre del proyecto, puedes acceder a la propiedad `name` del diccionario del proyecto.
++ No necesitas hacer un bucle (loop), solo accede al segundo elemento como una lista usando la posición.
diff --git a/exercises/06-project-list/README.md b/exercises/06-project-list/README.md
index 1312bfd..c4c8e0e 100644
--- a/exercises/06-project-list/README.md
+++ b/exercises/06-project-list/README.md
@@ -1,15 +1,16 @@
# `06` Project List
-The following endpoint returns a JSON formated response with several projects in a list:
+The following endpoint returns a JSON formatted response with several projects in a list:
GET: [https://assets.breatheco.de/apis/fake/sample/project_list.php](https://assets.breatheco.de/apis/fake/sample/project_list.php)
Each of the projects has the following format (example):
+
```json
{
"name": "Coursera eLearning",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "The coolest eLearning site on the planet",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -19,22 +20,22 @@ Each of the projects has the following format (example):
}
```
-# 📝 Instructions
+## 📝 Instructions:
-Please call the endpoint and print the name of the **SECOND** project on the list:
+1. Please call the endpoint and print the name of the **SECOND** project on the list:
Example output:
-```bash
+```text
Coursera eLearning
```
-## 💡Hint
+## 💡 Hints:
-1. Open the endpoint on your browser and analyze the response body, you need to know what to expect, what is going to be the structure of the data (response body) coming back from the server.
-2. In this case the response body starts with a square bracket `[`, it's a list, you have to access the second project by using numerical positions.
-2. Do a GET request to the endpoint.
-3. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
-4. Find the second project on the list.
-5. Print the project name, you can access the property name of the project dictionary.
-6. You don't need to loop, just access the second item like a list using the position
++ Open the endpoint on your browser and analyze the response body, you need to know what to expect, what is going to be the structure of the data (response body) coming back from the server.
++ In this case, the response body starts with a square bracket `[`, it's a list, and you have to access the second project by using numerical positions.
++ Make a GET request to the endpoint.
++ Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
++ Find the second project on the list.
++ Print the project name, you can access the property `name` of the project dictionary.
++ You don't need to loop, just access the second item like a list using the position.
diff --git a/exercises/06-project-list/app.py b/exercises/06-project-list/app.py
index a471294..0ca5c86 100644
--- a/exercises/06-project-list/app.py
+++ b/exercises/06-project-list/app.py
@@ -1,3 +1,3 @@
import requests
-# your code here
\ No newline at end of file
+# Your code here
\ No newline at end of file
diff --git a/exercises/06-project-list/solution.hide.py b/exercises/06-project-list/solution.hide.py
new file mode 100644
index 0000000..8cdcd5f
--- /dev/null
+++ b/exercises/06-project-list/solution.hide.py
@@ -0,0 +1,15 @@
+import requests
+
+# Your code here
+response = requests.get("https://assets.breatheco.de/apis/fake/sample/project_list.php")
+
+if response.status_code == 200:
+ # Parsing JSON response
+ project_list = response.json()
+
+ # Extracting the name of the second project
+ second_project_name = project_list[1]["name"]
+
+ print(second_project_name)
+else:
+ print("Failed to fetch project list.")
\ No newline at end of file
diff --git a/exercises/06-project-list/test.py b/exercises/06-project-list/test.py
index 4d7945b..66ba249 100644
--- a/exercises/06-project-list/test.py
+++ b/exercises/06-project-list/test.py
@@ -6,9 +6,9 @@ class FakeResponse(object):
status_code = 200
def json(self):
return [{
- "name": "Stackbucks for milkshakes",
+ "name": "Starbucks for milkshakes",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -19,7 +19,7 @@ def json(self):
{
"name": "Uber for trucks",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -28,9 +28,9 @@ def json(self):
]
},
{
- "name": "McDonals for tacos",
+ "name": "McDonalds for tacos",
"thumb": "https://unsplash.it/450/320?image=178",
- "description": "The coolest elarning site on the planet",
+ "description": "",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -40,7 +40,7 @@ def json(self):
}
]
-@pytest.mark.it("requests.get has to be called to the project url")
+@pytest.mark.it("requests.get has to be called for the project_list.php url")
def test_url_call(capsys, app):
with patch('requests.get') as mock_request:
app()
@@ -52,7 +52,7 @@ def test_url_output2(capsys, app):
mock_request.return_value = FakeResponse()
app()
captured = capsys.readouterr()
- assert "McDonals for tacos\n" != captured.out
+ assert "McDonalds for tacos\n" != captured.out
@pytest.mark.it("Make sure you are printing the project name")
def test_url_output1(capsys, app):
diff --git a/exercises/07-project-list-image/README.es.md b/exercises/07-project-list-image/README.es.md
index 0c5c96b..d155f02 100644
--- a/exercises/07-project-list-image/README.es.md
+++ b/exercises/07-project-list-image/README.es.md
@@ -1,20 +1,21 @@
-# `07` Lista de las Imagenes del Proyecto
+# `07` Project List Image
-# 📝 Instrucciones
+## 📝 Instrucciones:
-Haz una solicitud GET a la misma URL que en el ejercicio anterior, imprime la `última` url image (imagen de la url) en el `último` proyecto.
+1. Haz una solicitud GET a la misma URL que en el ejercicio anterior, imprime la **última** URL de las imagenes del **último** proyecto.
Ejemplo:
-```bash
+
+```text
https://image.shutterstock.com/image-vector/trophy-cup-award-vector-icon-260nw-592525184.jpg
```
-## 💡Pista
+## 💡 Pistas:
-1. Haz una solicitud GET al endpoint.
-2. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario.
-3. Encuentra el último proyecto en la lista.
-4. Encuentra la última imagen de ese proyecto.
-5. Imprima la imagen de la URL en la consola.
-6. No es necesario realizar un bucle (loop), solo use las posiciones numéricas (índice/index) para acceder a la información
++ Haz una solicitud GET al endpoint.
++ Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario.
++ Encuentra el último proyecto en la lista.
++ Encuentra la última imagen de ese proyecto.
++ Imprime la URL de esa imagen en la consola.
++ No es necesario realizar un bucle, solo usa las posiciones numéricas (índice/index) para acceder a la información.
diff --git a/exercises/07-project-list-image/README.md b/exercises/07-project-list-image/README.md
index 5b37214..94985d1 100644
--- a/exercises/07-project-list-image/README.md
+++ b/exercises/07-project-list-image/README.md
@@ -1,20 +1,21 @@
# `07` Project List Image
-# 📝 Instructions
+## 📝 Instructions:
-Do a GET request to the same URL as in the previous exercise, print the `last` image URL in the `last` project.
+1. Do a GET request to the same URL as in the previous exercise, print the **last** image URL in the **last** project.
Example output:
-```bash
+
+```text
https://image.shutterstock.com/image-vector/trophy-cup-award-vector-icon-260nw-592525184.jpg
```
-## 💡Hint
+## 💡 Hints:
-1. Do a GET request to the endpoint.
-2. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
-3. Find the last project on the list.
-4. Find the last image of that project.
-5. Print the image URL on the console.
-6. No need to loop, just use the numerical positions (index) to access the information
++ Do a GET request to the endpoint.
++ Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
++ Find the last project on the list.
++ Find the last image of that project.
++ Print the image URL on the console.
++ No need to loop, just use the numerical positions (index) to access the information.
diff --git a/exercises/07-project-list-image/app.py b/exercises/07-project-list-image/app.py
index a471294..0ca5c86 100644
--- a/exercises/07-project-list-image/app.py
+++ b/exercises/07-project-list-image/app.py
@@ -1,3 +1,3 @@
import requests
-# your code here
\ No newline at end of file
+# Your code here
\ No newline at end of file
diff --git a/exercises/07-project-list-image/solution.hide.py b/exercises/07-project-list-image/solution.hide.py
new file mode 100644
index 0000000..b52a93f
--- /dev/null
+++ b/exercises/07-project-list-image/solution.hide.py
@@ -0,0 +1,19 @@
+import requests
+
+# Your code here
+response = requests.get("https://assets.breatheco.de/apis/fake/sample/project_list.php")
+
+if response.status_code == 200:
+ # Parsing JSON response
+ project_list = response.json()
+
+ # Extracting the last project
+ last_project = project_list[-1]
+
+ # Extracting the last image URL
+ last_image_url = last_project["images"][-1]
+
+ # Printing the last image URL
+ print(last_image_url)
+else:
+ print("Failed to fetch project list.")
\ No newline at end of file
diff --git a/exercises/07-project-list-image/test.py b/exercises/07-project-list-image/test.py
index 3a733a7..b18b204 100644
--- a/exercises/07-project-list-image/test.py
+++ b/exercises/07-project-list-image/test.py
@@ -18,7 +18,7 @@ def json(self):
{
"name" : "Coursera eLearning",
"thumb" : "https://unsplash.it/450/320?image=178",
- "description" : "The coolest elarning site on the planet",
+ "description" : "The coolest eLearning site on the planet",
"images" : [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
@@ -29,7 +29,7 @@ def json(self):
{
"name" : "Company Website",
"thumb" : "https://unsplash.it/450/320?image=278",
- "description" : "Super boring company porfolio website with the tipical about us, home, contact us sections",
+ "description" : "Super boring company portfolio website with the typical about us, home, and contact us sections",
"images" : [
"https://unsplash.it/450/320?image=278",
"https://unsplash.it/450/320?image=280",
@@ -38,7 +38,7 @@ def json(self):
}
]
-@pytest.mark.it("requests.get has to be called to the project url")
+@pytest.mark.it("requests.get has to be called for the project_list.php url")
def test_url_call(capsys, app):
with patch('requests.get') as mock_request:
app()
diff --git a/exercises/08-blog-post-author/README.es.md b/exercises/08-blog-post-author/README.es.md
index ba99543..46037b0 100644
--- a/exercises/08-blog-post-author/README.es.md
+++ b/exercises/08-blog-post-author/README.es.md
@@ -1,20 +1,22 @@
-# `08` Publicar autor de blog
+# `08` Post blog author
-Tómate un momento para comprender el body response al hacer una solicitud GET a este endpoint:
+Tómate un momento para comprender el response body al hacer una solicitud GET a este endpoint:
[https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php](https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php)
-👉🏼 [Aquí hay una breve explicación en video.](https://www.youtube.com/watch?v=fwfBYVrvSk0)
+> 👉🏼 [Aquí hay una breve explicación en video.](https://www.youtube.com/watch?v=fwfBYVrvSk0)
-# 📝 Instrucciones
+
-Obtén el nombre del autor de la primera publicación.
+## 📝 Instrucciones:
-## 💡Pista
+1. Obtén el nombre del autor de la primera publicación.
-1. Haz una solicitud GET al endpoint.
-2. Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario.
-3. Encuentra la primera publicación
-4. Obtén el autor del diccionario
-5. Escribe el nombre del autor
-6. No necesitas hacer un bucle (loop), solo usa las posiciones (índice/index)
+## 💡 Pistas:
+
++ Haz una solicitud GET al endpoint.
++ Usa el [metodo .json()](https://www.w3schools.com/python/ref_requests_response.asp) para obtener el response body como un diccionario.
++ Encuentra la primera publicación.
++ Obtén el diccionario `author`.
++ Imprime el nombre del autor.
++ No necesitas hacer un bucle, solo usa las posiciones (índice/index).
diff --git a/exercises/08-blog-post-author/README.md b/exercises/08-blog-post-author/README.md
index 17d8775..f31550a 100644
--- a/exercises/08-blog-post-author/README.md
+++ b/exercises/08-blog-post-author/README.md
@@ -3,20 +3,20 @@
Take a moment to understand the response body when doing a GET request to this endpoint:
[https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php](https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php)
-👉🏼 [Here is a brief video explanation.](https://www.youtube.com/watch?v=fwfBYVrvSk0)
+> 👉🏼 [Here is a brief video explanation.](https://www.youtube.com/watch?v=fwfBYVrvSk0)

-# 📝 Instructions
+## 📝 Instructions:
-Get the author name of the first post.
+1. Get the author name of the first post.
-## 💡Hint
+## 💡 Hints:
-1. Do a GET request to the endpoint.
-2. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
-3. Find the first post
-4. Get the author dictionary
-5. Print author name
-6. You dont need to loop, jsut use the positions (index).
++ Do a GET request to the endpoint.
++ Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
++ Find the first post.
++ Get the `author` dictionary.
++ Print the author name.
++ You don't need to loop, just use the positions (index).
diff --git a/exercises/08-blog-post-author/app.py b/exercises/08-blog-post-author/app.py
index a471294..0ca5c86 100644
--- a/exercises/08-blog-post-author/app.py
+++ b/exercises/08-blog-post-author/app.py
@@ -1,3 +1,3 @@
import requests
-# your code here
\ No newline at end of file
+# Your code here
\ No newline at end of file
diff --git a/exercises/08-blog-post-author/solution.hide.py b/exercises/08-blog-post-author/solution.hide.py
new file mode 100644
index 0000000..2d25260
--- /dev/null
+++ b/exercises/08-blog-post-author/solution.hide.py
@@ -0,0 +1,21 @@
+import requests
+
+# Your code here
+response = requests.get("https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php")
+
+if response.status_code == 200:
+ # Parsing JSON response
+ data = response.json()
+
+ # Getting the first post
+ first_post = data["posts"][0]
+
+ # Getting the author dictionary
+ author_dict = first_post["author"]
+
+ # Getting the author name
+ author_name = author_dict["name"]
+
+ print(author_name)
+else:
+ print("Failed to fetch data from the endpoint.")
\ No newline at end of file
diff --git a/exercises/08-blog-post-author/test.py b/exercises/08-blog-post-author/test.py
index 6bb9ed6..a69d0f4 100644
--- a/exercises/08-blog-post-author/test.py
+++ b/exercises/08-blog-post-author/test.py
@@ -11,7 +11,7 @@ def json(self):
]
}
-@pytest.mark.it("requests.get has to be called to the project url")
+@pytest.mark.it("requests.get has to be called for the weird_portfolio.php url")
def test_url_call(capsys, app):
with patch('requests.get') as mock_request:
app()
diff --git a/exercises/09-array-of-blog-titles/README.es.md b/exercises/09-array-of-blog-titles/README.es.md
deleted file mode 100644
index a341d3e..0000000
--- a/exercises/09-array-of-blog-titles/README.es.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# `09` Arreglo con titulos de publicaciones
-
-# 📝 Instrucciones
-
-Usando el mismo endpoint del ejercicio anterior, crea una función `get_titles` que retorne los titulos de todos los post (publicaciones) encontradas en el response body.
-
-## 💡Pista
-
-1. Crea una función `get_titles`.
-2. Declara un array vacío llamado `titles`.
-3. Haz el request del API adentro de la función.
-4. realiza un bucle (Loop) que itere para cada publicación.
-5. Agregue cada título de publicación al nuevo arreglo.
-6. Retorna el arreglo.
-
-La salida de la consola debería verse parecido a esto:
-
-```python
-['title 1','title 2', 'title 3']
-```
\ No newline at end of file
diff --git a/exercises/09-array-of-blog-titles/README.md b/exercises/09-array-of-blog-titles/README.md
deleted file mode 100644
index 0c1a241..0000000
--- a/exercises/09-array-of-blog-titles/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# `09` Array of blog titles
-
-# 📝 Instructions
-
-Using the same endpoint from the previous exercise, create a function `get_titles` that returns the titles of all the posts found in the response body.
-
-## 💡Hint
-
-1. Create the function `get_titles`.
-2. Declare a new empty array called `titles`.
-3. Do the request to the endpoint inside of the function.
-4. Loop each post from the list of posts.
-5. Get the title of each post.
-6. Add that title to the new array.
-7. Return the titles array.
-
-The console output should be something similar to this:
-
-```python
-['title 1','title 2', 'title 3']
-```
\ No newline at end of file
diff --git a/exercises/09-list-of-blog-titles/README.es.md b/exercises/09-list-of-blog-titles/README.es.md
new file mode 100644
index 0000000..496528f
--- /dev/null
+++ b/exercises/09-list-of-blog-titles/README.es.md
@@ -0,0 +1,20 @@
+# `09` List of blog titles
+
+## 📝 Instrucciones:
+
+1. Usando el mismo endpoint del ejercicio anterior, crea una función `get_titles` que retorne los títulos de todas las publicaciones encontradas en el response body.
+
+## 💡 Pistas:
+
++ Crea una función `get_titles`.
++ Declara una lista vacía llamada `titles`.
++ Haz el request del API adentro de la función.
++ realiza un bucle que itere para cada publicación.
++ Agregue cada título a la nueva lista.
++ Retorna la lista `titles`.
+
+La salida de la consola debería verse parecido a esto:
+
+```python
+['title 1', 'title 2', 'title 3']
+```
\ No newline at end of file
diff --git a/exercises/09-list-of-blog-titles/README.md b/exercises/09-list-of-blog-titles/README.md
new file mode 100644
index 0000000..dd5b70f
--- /dev/null
+++ b/exercises/09-list-of-blog-titles/README.md
@@ -0,0 +1,21 @@
+# `09` List of blog titles
+
+## 📝 Instructions:
+
+1. Using the same endpoint from the previous exercise, create a function `get_titles` that returns the titles of all the posts found in the response body.
+
+## 💡 Hints:
+
++ Create the function `get_titles`.
++ Declare a new empty list called `titles`.
++ Do the request to the endpoint inside the function.
++ Loop each post from the list of posts.
++ Get the title of each post.
++ Add that title to the new list.
++ Return the `titles` list.
+
+The console output should be something similar to this:
+
+```python
+['title 1', 'title 2', 'title 3']
+```
\ No newline at end of file
diff --git a/exercises/09-array-of-blog-titles/app.py b/exercises/09-list-of-blog-titles/app.py
similarity index 77%
rename from exercises/09-array-of-blog-titles/app.py
rename to exercises/09-list-of-blog-titles/app.py
index e464bad..cc536a8 100644
--- a/exercises/09-array-of-blog-titles/app.py
+++ b/exercises/09-list-of-blog-titles/app.py
@@ -1,7 +1,7 @@
import requests
def get_titles():
- # your code here
+ # Your code here
return None
diff --git a/exercises/09-list-of-blog-titles/solution.hide.py b/exercises/09-list-of-blog-titles/solution.hide.py
new file mode 100644
index 0000000..090093b
--- /dev/null
+++ b/exercises/09-list-of-blog-titles/solution.hide.py
@@ -0,0 +1,25 @@
+import requests
+
+def get_titles():
+ # Your code here
+ url = "https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php"
+
+ titles = []
+
+ response = requests.get(url)
+
+ if response.status_code == 200:
+ # Parsing JSON response
+ data = response.json()
+
+ for post in data["posts"]:
+ title = post["title"]
+ if title:
+ titles.append(title)
+ else:
+ print("Failed to fetch data from the endpoint.")
+
+ return titles
+
+
+print(get_titles())
\ No newline at end of file
diff --git a/exercises/09-array-of-blog-titles/test.py b/exercises/09-list-of-blog-titles/test.py
similarity index 80%
rename from exercises/09-array-of-blog-titles/test.py
rename to exercises/09-list-of-blog-titles/test.py
index 59965c8..e1b05b8 100644
--- a/exercises/09-array-of-blog-titles/test.py
+++ b/exercises/09-list-of-blog-titles/test.py
@@ -7,14 +7,14 @@ class FakeResponse(object):
def json(self):
return {
"posts": [
- { "title": 'R.I.P. Ruby on Rails. Thanks for everything.' },
+ {"title": 'R.I.P. Ruby on Rails. Thanks for everything.'},
{"title": 'The fraud behind the C.A. of digital certificates is over'},
{"title": 'Manteniendo las raices'},
- {"title":'DF Tech Meetup, ya es una realidad'}
+ {"title": 'DF Tech Meetup, ya es una realidad'}
]
}
-@pytest.mark.it("You seem to be returning None or not retuning anything")
+@pytest.mark.it("You seem to be returning None or not returning anything")
def test_for_null(app):
with patch('requests.get') as mock_request:
from app import get_titles
@@ -30,7 +30,7 @@ def test_return_type(app):
tags = get_titles()
assert isinstance(tags, list)
-@pytest.mark.it("Return a list of post titles like: ['title 1','title 2', 'title 3']")
+@pytest.mark.it("Return a list of post titles like: ['title 1', 'title 2', 'title 3']")
def test_array_content(app):
with patch('requests.get') as mock_request:
from app import get_titles
diff --git a/exercises/10-get-post-tags/README.es.md b/exercises/10-get-post-tags/README.es.md
new file mode 100644
index 0000000..cff0c68
--- /dev/null
+++ b/exercises/10-get-post-tags/README.es.md
@@ -0,0 +1,14 @@
+# `10` Get post tags
+
+## 📝 Instrucciones:
+
+1. Usando el mismo endpoint del ejercicio anterior, crea una función `get_post_tags` que retorne el arreglo de etiquetas (tags) de un `post_id` dado.
+
+## 💡 Pistas:
+
++ Crea la función `get_post_tags`.
++ Obtén todas las publicaciones (post) haciendo la solicitud GET al endpoint.
++ Declare la variable para almacenar el body serializado.
++ Usando el parámetro `post_id`, recorre con un loop todas las publicaciones y compara sus ID para ver si coinciden con el `post_id`.
++ Cuando encuentres la publicación que deseas, devuelve una lista de etiquetas (tags).
+
diff --git a/exercises/10-get-post-tags/README.md b/exercises/10-get-post-tags/README.md
new file mode 100644
index 0000000..6d974a7
--- /dev/null
+++ b/exercises/10-get-post-tags/README.md
@@ -0,0 +1,14 @@
+# `10` Get post tags
+
+## 📝 Instructions:
+
+1. Using the same endpoint from the previous exercise, create a function `get_post_tags` that returns the array of tags of a given `post_id`
+
+## 💡 Hints:
+
++ Create the function `get_post_tags`.
++ GET all the posts by sending a GET request to the endpoint.
++ Declare the variable to store the serialized body
++ Using the `post_id` parameter, loop all the posts and compare their `id`s to see if they match the `post_id`.
++ When you find the post you want, return its list of tags.
+
diff --git a/exercises/10-get_post_tags/app.py b/exercises/10-get-post-tags/app.py
similarity index 80%
rename from exercises/10-get_post_tags/app.py
rename to exercises/10-get-post-tags/app.py
index 0889c24..ff6d142 100644
--- a/exercises/10-get_post_tags/app.py
+++ b/exercises/10-get-post-tags/app.py
@@ -1,7 +1,7 @@
import requests
def get_post_tags(post_id):
- # your code here
+ # Your code here
return None
diff --git a/exercises/10-get-post-tags/solution.hide.py b/exercises/10-get-post-tags/solution.hide.py
new file mode 100644
index 0000000..f97c043
--- /dev/null
+++ b/exercises/10-get-post-tags/solution.hide.py
@@ -0,0 +1,23 @@
+import requests
+
+def get_post_tags(post_id):
+ # Your code here
+ url = "https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php"
+
+ response = requests.get(url)
+
+ if response.status_code == 200:
+ # Parsing JSON response
+ data = response.json()
+
+ # Loop through each post to find the one with matching post_id
+ for post in data["posts"]:
+ if post["id"] == post_id:
+ return post["tags"]
+ print("No post found")
+
+ else:
+ print("Failed to fetch data from the endpoint.")
+
+
+print(get_post_tags(146))
\ No newline at end of file
diff --git a/exercises/10-get_post_tags/test.py b/exercises/10-get-post-tags/test.py
similarity index 100%
rename from exercises/10-get_post_tags/test.py
rename to exercises/10-get-post-tags/test.py
diff --git a/exercises/10-get_post_tags/README.es.md b/exercises/10-get_post_tags/README.es.md
deleted file mode 100644
index 3293758..0000000
--- a/exercises/10-get_post_tags/README.es.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# `10` Obtener etiqueta de publicación
-
-# 📝 Instrucciones
-
-Usando el mismo endpoint del ejercicio anterior, crea una función `get_post_tags` que retorne el arreglo de etiquetas (tags) de un `post id` dado.
-
-## 💡Pista
-
-1. Crea la función `get_post_tags`.
-2. Obtén todas las publicaciones (post) haciendo la solicitud GET al endpoint.
-3. Declare la variable para almacenar el body serializado
-4. Usando el parámetro `post_id`, recorre con un loop todas las publicaciones y compara sus ID para ver si coinciden con el` post_id`.
-3. Cuando encuentres la publicación que deseas, devuelve una lista de etiquetas (tags)
-
diff --git a/exercises/10-get_post_tags/README.md b/exercises/10-get_post_tags/README.md
deleted file mode 100644
index 9529c07..0000000
--- a/exercises/10-get_post_tags/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# `10` Get post tags
-
-# 📝 Instructions
-
-Using the same endpoint from the previous exercise, create a function `get_post_tags` that returns the array of tags of a given `post id`
-
-## 💡Hint
-
-1. Create the function `get_post_tags`.
-2. GET all the posts by doing the GET request to the endpoint.
-3. declare the variable to store the serialized body
-4. Using the `post_id` parameter loop all the posts and compare their id's to see if they match the `post_id`.
-3. When you find the post you want, return it's list of tags
-
diff --git a/exercises/11-get-attachment-by-id/README.es.md b/exercises/11-get-attachment-by-id/README.es.md
new file mode 100644
index 0000000..3b3ce59
--- /dev/null
+++ b/exercises/11-get-attachment-by-id/README.es.md
@@ -0,0 +1,13 @@
+# `11` Get attachment by id
+
+## 📝 Instrucciones:
+
+1. Usando el mismo endpoint del ejercicio anterior, crea una función `get_attachment_by_id` que retorne el título de los archivos adjuntos (attachments) que corresponden con el `id` dado.
+
+## 💡 Pistas:
+
++ Crea la función `get_attachment_by_id` que reciba el `attachment_id` como un parámetro.
++ Recorre con un bucle todos los posts.
++ Recorre con un bucle todos los archivos adjuntos (attachments) de cada post.
++ Si el archivo adjunto (attachment) tiene el `attachment_id` dado en el parámetro de la función, devuélvelo.
+
diff --git a/exercises/11-get-attachment-by-id/README.md b/exercises/11-get-attachment-by-id/README.md
new file mode 100644
index 0000000..5fb34df
--- /dev/null
+++ b/exercises/11-get-attachment-by-id/README.md
@@ -0,0 +1,13 @@
+# `11` Get attachment by id
+
+## 📝 Instructions:
+
+1. Using the same endpoint from the previous exercise, create a function `get_attachment_by_id` that returns the title of the attachment that corresponds to the given `id`.
+
+## 💡 Hints:
+
++ Create the function `get_attachment_by_id` that receives the `attachment_id` as a parameter.
++ Loop all the posts.
++ Loop all the `attachments` for each post.
++ If the attachment has the given `attachment_id` in the function parameter, return it.
+
diff --git a/exercises/11-get_attachment_by_id/app.py b/exercises/11-get-attachment-by-id/app.py
similarity index 83%
rename from exercises/11-get_attachment_by_id/app.py
rename to exercises/11-get-attachment-by-id/app.py
index 26274ff..3571d84 100644
--- a/exercises/11-get_attachment_by_id/app.py
+++ b/exercises/11-get-attachment-by-id/app.py
@@ -1,7 +1,7 @@
import requests
def get_attachment_by_id(attachment_id):
- # your code here
+ # Your code here
return None
print(get_attachment_by_id(137))
\ No newline at end of file
diff --git a/exercises/11-get-attachment-by-id/solution.hide.py b/exercises/11-get-attachment-by-id/solution.hide.py
new file mode 100644
index 0000000..d09dc7d
--- /dev/null
+++ b/exercises/11-get-attachment-by-id/solution.hide.py
@@ -0,0 +1,25 @@
+import requests
+
+def get_attachment_by_id(attachment_id):
+ # Your code here
+ url = "https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php"
+
+ response = requests.get(url)
+
+ if response.status_code == 200:
+ # Parsing JSON response
+ data = response.json()
+
+ for post in data["posts"]:
+ # Check if the post has attachments
+ if "attachments" in post:
+ # Loop through each attachment
+ for attachment in post["attachments"]:
+ if attachment["id"] == attachment_id:
+ return attachment["title"]
+
+ print("No attachment found")
+ else:
+ print("Failed to fetch data from the endpoint.")
+
+print(get_attachment_by_id(137))
\ No newline at end of file
diff --git a/exercises/11-get_attachment_by_id/test.py b/exercises/11-get-attachment-by-id/test.py
similarity index 63%
rename from exercises/11-get_attachment_by_id/test.py
rename to exercises/11-get-attachment-by-id/test.py
index c413668..739579d 100644
--- a/exercises/11-get_attachment_by_id/test.py
+++ b/exercises/11-get-attachment-by-id/test.py
@@ -7,15 +7,15 @@ class FakeResponse(object):
def json(self):
return {
"posts": [
- { "attachments": [{ "id": 22, "title": "asd" }] },
- { "attachments": [{ "id": 137, "title": "cert" }] },
- { "attachments": [{ "id": 11, "title": "asd" }] },
- { "attachments": [{ "id": 40, "title": "asd" }] },
- { "attachments": [{ "id": 314, "title": "asd" }] },
+ { "attachments": [{ "id": 22, "title": "Invoice" }] },
+ { "attachments": [{ "id": 137, "title": "Training Certificate" }] },
+ { "attachments": [{ "id": 11, "title": "Presentation Slides" }] },
+ { "attachments": [{ "id": 40, "title": "Meeting Agenda" }] },
+ { "attachments": [{ "id": 314, "title": "Project Proposal" }] },
]
}
-@pytest.mark.it("You seem to be returning None or not retuning anything on the function")
+@pytest.mark.it("You seem to be returning None or not returning anything on the function")
def test_for_null(app):
with patch('requests.get') as mock_request:
from app import get_attachment_by_id
@@ -23,7 +23,7 @@ def test_for_null(app):
att = get_attachment_by_id(137)
assert att is not None
-@pytest.mark.it("The function should have returned a string (the att title) but returnied something different")
+@pytest.mark.it("The function should have returned a string (the attachment title) but returned something different")
def test_return_type(app):
with patch('requests.get') as mock_request:
from app import get_attachment_by_id
@@ -37,4 +37,4 @@ def test_array_content(app):
from app import get_attachment_by_id
mock_request.return_value = FakeResponse()
title = get_attachment_by_id(137)
- assert title == "cert"
+ assert title == "Training Certificate"
diff --git a/exercises/11-get_attachment_by_id/README.es.md b/exercises/11-get_attachment_by_id/README.es.md
deleted file mode 100644
index d7b82c2..0000000
--- a/exercises/11-get_attachment_by_id/README.es.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# `11` Obtener un archivo adjunto (attachment) por id
-
-# 📝 Instrucciones
-
-Usando el mismo endpoint del ejercicio anterior, crea una función `get_attachment_by_id` que retornes el titulo de los adjuntos que correspondan con el id dado.
-
-## 💡Pista
-
-1. Crea la función `get_attachment_by_id` que reciba el `attachment_id` como un parametro.
-2. Recorre (Loop) todos los posts.
-3. Recorre (Loop) todos los attachments (adjuntos) de cada post.
-4. Si el archivo adjunto (attachment) tiene el `attach_id` dado en el parámetro de la función, devuélvalo.
-
diff --git a/exercises/11-get_attachment_by_id/README.md b/exercises/11-get_attachment_by_id/README.md
deleted file mode 100644
index 5f3864e..0000000
--- a/exercises/11-get_attachment_by_id/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# `11` Get attachment by id
-
-# 📝 Instructions
-
-Using the same endpoint from the previous exercise, create a function `get_attachment_by_id` that returns the title of the attachtment that corresponds to the given id.
-
-## 💡Hint
-
-1. Create the function `get_attachment_by_id` that recives the `attachment_id` as a parameter.
-2. Loop all the posts.
-3. Loop all the attachments for each post.
-4. If the attachment has the given `attachment_id` in the function parameter, return it.
-
diff --git a/exercises/12-post-request/README.es.md b/exercises/12-post-request/README.es.md
index fc7a1a7..13db050 100644
--- a/exercises/12-post-request/README.es.md
+++ b/exercises/12-post-request/README.es.md
@@ -1,8 +1,8 @@
-# `12` Solicitud POST
+# `12` POST request
-Las solicitudes POST están destinadas a la creación, por ejemplo, si tu negocio es un e-comerce de camisas , es probable que desee tener una forma de agregar nuevos clientes.
+Las solicitudes POST están destinadas a la creación, por ejemplo, si tu negocio es un e-commerce de camisetas, es probable que desees tener una forma de agregar nuevos clientes.
-Una solicitud de post generalmente tiene:
+Una solicitud de POST (*POST request*) generalmente tiene:
| | |
| ---- | ---- |
@@ -10,16 +10,15 @@ Una solicitud de post generalmente tiene:
| Content-Type | application/json |
| Body (payload) | JSON string |
-# 📝 Instrucciones
+## 📝 Instrucciones:
-Envía una solitud POST al siguiente URL:
+1. Envía una solitud POST al siguiente URL:
POST: https://assets.breatheco.de/apis/fake/sample/post.php
-E imprime la respuesta (text response) en la consolae
+2. Imprime la respuesta (response text) en la consola.
-## 💡Pista
+## 💡 Pista:
-Usa el paquete de solicitudes del metodo post:
-https://www.w3schools.com/python/ref_requests_post.asp
++ Usa el método POST del paquete *requests*: https://www.w3schools.com/python/ref_requests_post.asp
diff --git a/exercises/12-post-request/README.md b/exercises/12-post-request/README.md
index fab7e53..7633825 100644
--- a/exercises/12-post-request/README.md
+++ b/exercises/12-post-request/README.md
@@ -1,8 +1,8 @@
# `12` POST request
-POST requests are meant for creation, for example, if your business is an t-shirt e-commerce you probably want to have a way to add new clients.
+POST requests are meant for creation, for example, if your business is a t-shirt e-commerce you probably want to have a way to add new clients.
-A post request usually have:
+A POST request usually has:
| | |
| ---- | ---- |
@@ -10,16 +10,15 @@ A post request usually have:
| Content-Type | application/json |
| Body (payload) | JSON string |
-# 📝 Instructions
+## 📝 Instructions:
-Send a POST request to the following URL:
+1. Send a POST request to the following URL:
POST: https://assets.breatheco.de/apis/fake/sample/post.php
-And print the response text on the console
+2. And print the response text on the console.
-## 💡Hint
+## 💡 Hint:
-Use the requests package post method:
-https://www.w3schools.com/python/ref_requests_post.asp
++ Use the requests package POST method: https://www.w3schools.com/python/ref_requests_post.asp
diff --git a/exercises/12-post-request/app.py b/exercises/12-post-request/app.py
index a471294..0ca5c86 100644
--- a/exercises/12-post-request/app.py
+++ b/exercises/12-post-request/app.py
@@ -1,3 +1,3 @@
import requests
-# your code here
\ No newline at end of file
+# Your code here
\ No newline at end of file
diff --git a/exercises/12-post-request/solution.hide.py b/exercises/12-post-request/solution.hide.py
new file mode 100644
index 0000000..631052e
--- /dev/null
+++ b/exercises/12-post-request/solution.hide.py
@@ -0,0 +1,8 @@
+import requests
+
+# Your code here
+url = "https://assets.breatheco.de/apis/fake/sample/post.php"
+
+response = requests.post(url)
+
+print(response.text)
\ No newline at end of file
diff --git a/exercises/12-post-request/test.py b/exercises/12-post-request/test.py
index 7a5c98d..f49031f 100644
--- a/exercises/12-post-request/test.py
+++ b/exercises/12-post-request/test.py
@@ -1,7 +1,7 @@
import json, pytest
from mock import patch
-@pytest.mark.it("POST request to the specified endpoint")
+@pytest.mark.it("Make a POST request to the specified endpoint")
def test_url(app):
with patch('requests.post') as mock_request:
app()
diff --git a/exercises/13-post-request-body/README.es.md b/exercises/13-post-request-body/README.es.md
index bc8505b..4360e54 100644
--- a/exercises/13-post-request-body/README.es.md
+++ b/exercises/13-post-request-body/README.es.md
@@ -1,24 +1,25 @@
# `13` POST request body
-# 📝 Instrucciones
+## 📝 Instrucciones:
-Envía una solitud POST al siguiente URL:
+1. Envía una solitud POST al siguiente URL:
+
+```text
https://assets.breatheco.de/apis/fake/sample/save-project-json.php
+```
-Con `Content-Type: application/json`
+2. Con `Content-Type: application/json`
-Con el siguiente request body como texto JSON:
+3. Con el siguiente request body como texto JSON:
```json
{
- "id":2323,
+ "id": 2323,
"title": "Very big project"
}
-
```
-## 💡Pista
+## 💡 Pista:
-Usa el paquete de solicitudes del metodo post:
-https://www.w3schools.com/python/ref_requests_post.asp
++ Usa el método POST del paquete *requests*: https://www.w3schools.com/python/ref_requests_post.asp
diff --git a/exercises/13-post-request-body/README.md b/exercises/13-post-request-body/README.md
index 87bd5c3..1cfa911 100644
--- a/exercises/13-post-request-body/README.md
+++ b/exercises/13-post-request-body/README.md
@@ -1,24 +1,25 @@
# `13` POST request body
-# 📝 Instructions
+## 📝 Instructions:
-Send a POST request to the following URL:
+1. Send a POST request to the following URL:
+
+```text
https://assets.breatheco.de/apis/fake/sample/save-project-json.php
+```
-With `Content-Type: application/json`
+2. With `Content-Type: application/json`
-With the following request body as JSON text:
+3. With the following request body as JSON text:
```json
{
- "id":2323,
+ "id": 2323,
"title": "Very big project"
}
-
```
-## 💡Hint
+## 💡 Hint:
-Use the requests package post method:
-https://www.w3schools.com/python/ref_requests_post.asp
++ Use the requests package post method: https://www.w3schools.com/python/ref_requests_post.asp
diff --git a/exercises/13-post-request-body/app.py b/exercises/13-post-request-body/app.py
index 0edc6f1..df545c3 100644
--- a/exercises/13-post-request-body/app.py
+++ b/exercises/13-post-request-body/app.py
@@ -1,4 +1,4 @@
import requests
-resp = requests.post("https://assets.breatheco.de/apis/fake/sample/save-project-json.php")
-print(resp.text)
\ No newline at end of file
+response = requests.post("https://assets.breatheco.de/apis/fake/sample/save-project-json.php")
+print(response.text)
\ No newline at end of file
diff --git a/exercises/13-post-request-body/solution.hide.py b/exercises/13-post-request-body/solution.hide.py
new file mode 100644
index 0000000..97ca6d4
--- /dev/null
+++ b/exercises/13-post-request-body/solution.hide.py
@@ -0,0 +1,18 @@
+import requests
+
+url = "https://assets.breatheco.de/apis/fake/sample/save-project-json.php"
+
+data = {
+ "id": 2323,
+ "title": "Very big project"
+}
+
+# Setting the headers
+headers = {
+ "Content-Type": "application/json"
+}
+
+# Sending POST request with dictionary data
+response = requests.post(url, json=data, headers=headers)
+
+print(response.text)
\ No newline at end of file
diff --git a/exercises/13-post-request-body/test.py b/exercises/13-post-request-body/test.py
index e296165..df557a9 100644
--- a/exercises/13-post-request-body/test.py
+++ b/exercises/13-post-request-body/test.py
@@ -1,7 +1,7 @@
import json, pytest
from mock import patch
-@pytest.mark.it("POST request to the specified endpoint")
+@pytest.mark.it("Make a POST request to the specified endpoint")
def test_url(app):
with patch('requests.post') as mock_request:
app()
@@ -21,7 +21,7 @@ def test_headers(app):
if "content-type" in headers:
assert headers["content-type"].lower() == "application/json"
-@pytest.mark.it("Request body must be a dictionary json with id and title")
+@pytest.mark.it("Request body must be a json object with id and title")
def test_body(app):
with patch('requests.post') as mock_request:
app()
From 11c50904cbcc732fc518682f79026fbf80998516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Mon, 1 Apr 2024 11:23:46 -0500
Subject: [PATCH 11/27] Update devcontainer.json
---
.devcontainer/devcontainer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index d653790..40a3b24 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -21,7 +21,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.35 -g && learnpack plugins:install @learnpack/python@1.0.0"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.39 -g && learnpack plugins:install @learnpack/python@1.0.3"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
From c484f396ea2062b74deabef414ea7bb2ca89d6ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Mon, 1 Apr 2024 16:32:23 +0000
Subject: [PATCH 12/27] update to the latest learnpack versions on editor, cli
and compiler
---
.gitignore | 2 ++
exercises/{01-hello-world => 00-hello-world}/README.es.md | 0
exercises/{01-hello-world => 00-hello-world}/README.md | 0
exercises/01-what-is-a-request/README.es.md | 2 +-
exercises/01-what-is-a-request/README.md | 2 +-
exercises/01-what-is-a-request/app.py | 1 +
learn.json | 4 ++--
7 files changed, 7 insertions(+), 4 deletions(-)
rename exercises/{01-hello-world => 00-hello-world}/README.es.md (100%)
rename exercises/{01-hello-world => 00-hello-world}/README.md (100%)
diff --git a/.gitignore b/.gitignore
index 4598f93..09609ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,5 @@
!/.learn/resets/**
!/.learn/assets
!/.learn/assets/**
+
+__pycache_
\ No newline at end of file
diff --git a/exercises/01-hello-world/README.es.md b/exercises/00-hello-world/README.es.md
similarity index 100%
rename from exercises/01-hello-world/README.es.md
rename to exercises/00-hello-world/README.es.md
diff --git a/exercises/01-hello-world/README.md b/exercises/00-hello-world/README.md
similarity index 100%
rename from exercises/01-hello-world/README.md
rename to exercises/00-hello-world/README.md
diff --git a/exercises/01-what-is-a-request/README.es.md b/exercises/01-what-is-a-request/README.es.md
index 408b1d2..e959289 100644
--- a/exercises/01-what-is-a-request/README.es.md
+++ b/exercises/01-what-is-a-request/README.es.md
@@ -1,4 +1,4 @@
-# 02 Creando una solicitud (request)
+# 01 Creando una solicitud (request)
Python tiene un [paquete de solicitud (requests package)](https://requests.readthedocs.io/en/master/) eso permite a los desarrolladores crear solicitudes HTTP con bastante facilidad.
diff --git a/exercises/01-what-is-a-request/README.md b/exercises/01-what-is-a-request/README.md
index 413bd2e..7b1fb42 100644
--- a/exercises/01-what-is-a-request/README.md
+++ b/exercises/01-what-is-a-request/README.md
@@ -1,4 +1,4 @@
-# 02 Creating a request
+# 01 Creating a request
Python has a [requests package](https://requests.readthedocs.io/en/master/) that allows developers to create HTTP request pretty easily.
diff --git a/exercises/01-what-is-a-request/app.py b/exercises/01-what-is-a-request/app.py
index de2b192..7b78511 100644
--- a/exercises/01-what-is-a-request/app.py
+++ b/exercises/01-what-is-a-request/app.py
@@ -1,6 +1,7 @@
import requests
url = "https://assets.breatheco.de/apis/fake/sample/404-example.php"
+# url = "https://assets.breatheco.de/apis/fake/sample/hello.php"
response = requests.get(url)
print("The response status is: "+str(response.status_code))
\ No newline at end of file
diff --git a/learn.json b/learn.json
index 671213e..8a811da 100644
--- a/learn.json
+++ b/learn.json
@@ -6,7 +6,7 @@
},
"slug": "python-http-requests-api-tutorial-exercises",
"description": {
- "us": "Learn interactively to consume and create HTTP requests to API's using Python",
+ "us": "Learn interactively to consume and create HTTP requests to APIs using Python",
"es": "Aprende interactivamente cómo consumir APIs y hacer requests HTTP con Python"
},
"repository": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises",
@@ -19,6 +19,6 @@
"autoPlay": true,
"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
"editor": {
- "version": "3.1.6"
+ "version": "3.1.23"
}
}
From 855aa8283f63aa116f214d9fb6be74d86df0682b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Mon, 1 Apr 2024 14:32:06 -0500
Subject: [PATCH 13/27] Update .gitpod.Dockerfile
---
.gitpod.Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile
index 8040239..559d593 100644
--- a/.gitpod.Dockerfile
+++ b/.gitpod.Dockerfile
@@ -25,4 +25,4 @@ RUN echo "unset DATABASE_URL" >> $HOME/.bashrc
RUN echo "export DATABASE_URL" >> $HOME/.bashrc
RUN pip3 install pytest==6.2.5 pytest-testdox mock requests toml
-RUN npm i @learnpack/learnpack@2.1.20 -g && learnpack plugins:install @learnpack/python@1.0.0
+RUN npm i @learnpack/learnpack@2.1.39 -g && learnpack plugins:install @learnpack/python@1.0.3
From 6c2a1372d70ac90812fcd7e312750aade0ab0b24 Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Fri, 5 Apr 2024 21:20:58 +0200
Subject: [PATCH 14/27] Update README.es.md
---
exercises/00-welcome/README.es.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/exercises/00-welcome/README.es.md b/exercises/00-welcome/README.es.md
index 9c91a02..7f36107 100644
--- a/exercises/00-welcome/README.es.md
+++ b/exercises/00-welcome/README.es.md
@@ -4,10 +4,10 @@ Python Requests es el paquete más popular para consumir APIs y hacer solicitude
Aquí aprenderás:
-1. Cómo hacer solicitudes GET.
-2. Cómo obtener propiedades de datos e información.
-3. Cómo configurar request headers.
-4. Cómo configurar request content-type.
-5. Cómo hacer solicitudes POST.
+1. ¿Cómo hacer solicitudes GET?
+2. ¿Cómo obtener propiedades de datos e información?
+3. ¿Cómo configurar request headers?
+4. ¿Cómo configurar request content-type?
+5. ¿Cómo hacer solicitudes POST?
-Haga clic en el botón `Next →` en la esquina superior derecha para continuar.
\ No newline at end of file
+Haga clic en el botón `Next →` en la esquina superior derecha para continuar.
From 546e2a8f388cd7eec74ba0489cd07257b43530a1 Mon Sep 17 00:00:00 2001
From: Jose Mora <109150320+josemoracard@users.noreply.github.com>
Date: Fri, 5 Apr 2024 21:21:17 +0200
Subject: [PATCH 15/27] Update README.md
---
exercises/00-welcome/README.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/exercises/00-welcome/README.md b/exercises/00-welcome/README.md
index 580410c..c7d23c3 100644
--- a/exercises/00-welcome/README.md
+++ b/exercises/00-welcome/README.md
@@ -4,10 +4,10 @@ Python Requests is the most popular package for consuming APIs and doing HTTP re
Here you will learn:
-1. How to do GET requests.
-2. How to fetch data properties and information.
-3. How to set request headers.
-4. How to set request content-type.
-5. How to do POST requests.
+1. How to do GET requests?
+2. How to fetch data properties and information?
+3. How to set request headers?
+4. How to set request content-type?
+5. How to do POST requests?
-Click the `Next →` button on the top right to continue.
\ No newline at end of file
+Click the `Next →` button on the top right to continue.
From 0bb603d7d56d0e279f7755aaf05c6a6bd37b08d4 Mon Sep 17 00:00:00 2001
From: josemoracard
Date: Mon, 8 Apr 2024 15:41:43 +0000
Subject: [PATCH 16/27] more informative intro, deleted some folders
---
exercises/00-hello-world/README.es.md | 13 -------------
exercises/00-hello-world/README.md | 13 -------------
exercises/00-welcome/README.es.md | 4 +++-
exercises/00-welcome/README.md | 4 +++-
exercises/01-what-is-a-request/README.es.md | 20 --------------------
5 files changed, 6 insertions(+), 48 deletions(-)
delete mode 100644 exercises/00-hello-world/README.es.md
delete mode 100644 exercises/00-hello-world/README.md
delete mode 100644 exercises/01-what-is-a-request/README.es.md
diff --git a/exercises/00-hello-world/README.es.md b/exercises/00-hello-world/README.es.md
deleted file mode 100644
index 30f83f8..0000000
--- a/exercises/00-hello-world/README.es.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Python API Requests
-
-Python Requests es el paquete más popular para consumir API y hacer solicitudes HTTP.
-
-Aquí aprenderás:
-
-1. Cómo hacer solicitudes GET.
-2. Cómo obtener propiedades de una data e información.
-3. Cómo configurar request headers.
-4. Cómo configurar request content-type.
-5. Cómo hacer solicitudes POST.
-
-Haga click en el botón `next →` en la esquina superior derecha para continuar.
\ No newline at end of file
diff --git a/exercises/00-hello-world/README.md b/exercises/00-hello-world/README.md
deleted file mode 100644
index 3cb9e7e..0000000
--- a/exercises/00-hello-world/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Python API Requests
-
-Python Requests is the most popular package for consuming API's and doing HTTP requests.
-
-Here you will learn:
-
-1. How to do GET requests.
-2. How to fech data properties and information.
-3. How to set request headers.
-4. How to set request content-type.
-5. How to do POST requests.
-
-Click the `next →` button on the top right to continue.
\ No newline at end of file
diff --git a/exercises/00-welcome/README.es.md b/exercises/00-welcome/README.es.md
index 7f36107..51c6c3d 100644
--- a/exercises/00-welcome/README.es.md
+++ b/exercises/00-welcome/README.es.md
@@ -1,6 +1,8 @@
# `00` Welcome to Python API Requests!
-Python Requests es el paquete más popular para consumir APIs y hacer solicitudes HTTP.
+Python Requests es una herramienta potente y ampliamente utilizada para interactuar con APIs y realizar solicitudes HTTP en aplicaciones Python. Simplifica el proceso de enviar solicitudes HTTP y manejar respuestas, convirtiéndose en una herramienta favorita entre los desarrolladores para integrarse con servicios web y obtener datos de APIs.
+
+Con Python Requests, puedes hacer fácilmente solicitudes GET, POST, PUT, DELETE para comunicarte con servidores web y obtener datos. Admite el manejo de autenticación, encabezados, cookies y sesiones, permitiendo una integración sin problemas con diversos servicios web.
Aquí aprenderás:
diff --git a/exercises/00-welcome/README.md b/exercises/00-welcome/README.md
index c7d23c3..14b765e 100644
--- a/exercises/00-welcome/README.md
+++ b/exercises/00-welcome/README.md
@@ -1,6 +1,8 @@
# `00` Welcome to Python API Requests!
-Python Requests is the most popular package for consuming APIs and doing HTTP requests.
+Python Requests is a powerful and widely-used package for interacting with APIs and performing HTTP requests in Python applications. It simplifies the process of sending HTTP requests and handling responses, making it a favorite tool among developers for integrating with web services and fetching data from APIs.
+
+With Python Requests, you can easily make GET, POST, PUT, DELETE, to communicate with web servers and retrieve data. It supports handling authentication, headers, cookies, and sessions, allowing for seamless integration with various web services.
Here you will learn:
diff --git a/exercises/01-what-is-a-request/README.es.md b/exercises/01-what-is-a-request/README.es.md
deleted file mode 100644
index e959289..0000000
--- a/exercises/01-what-is-a-request/README.es.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# 01 Creando una solicitud (request)
-
-Python tiene un [paquete de solicitud (requests package)](https://requests.readthedocs.io/en/master/) eso permite a los desarrolladores crear solicitudes HTTP con bastante facilidad.
-
-Así es como en Python hacemos una solicitud HTTP GET:
-
-```python
-response = requests.get('')
-print(response.status_code)
-```
-
-# 📝 Instrucciones
-
-Cambie la variable URL para que solicite:
-
-```bash
-https://assets.breatheco.de/apis/fake/sample/hello.php
-```
-
-Nota: La consola debe imprimir un código de estado 200.
\ No newline at end of file
From 0734258185e6adfc33382bc4bb90bb02be8a7a84 Mon Sep 17 00:00:00 2001
From: Tomas Gonzalez <56565994+tommygonzaleza@users.noreply.github.com>
Date: Mon, 22 Apr 2024 17:34:34 -0400
Subject: [PATCH 17/27] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 4848bb7..7813c64 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ Each exercise is a small react application containing the following files:
2. **README.md:** contains exercise instructions.
3. **test.py:** you don't have to open this file, it contains the testing script for the exercise.
-> Note: The exercises have automatic grading, but it's very rigid and strict, my recommendation is to not take the tests too serious and use them only as a suggestion, or you may get frustrated.
+> Note: The exercises have automatic grading, but they're very rigid and strict, my recommendation is to not take the tests too serious and use them only as a suggestion, or you may get frustrated.
## Contributors
From d25b7ac05934fbb1ce6cb3de782b32b9e6bd7622 Mon Sep 17 00:00:00 2001
From: Charlytoc
Date: Tue, 23 Apr 2024 19:23:21 -0500
Subject: [PATCH 18/27] Update with new version of editor and cli
---
.devcontainer/devcontainer.json | 3 ++-
learn.json | 48 ++++++++++++++++++---------------
2 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 40a3b24..5893446 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,3 +1,4 @@
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
@@ -21,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.39 -g && learnpack plugins:install @learnpack/python@1.0.3"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.50 -g && learnpack plugins:install @learnpack/python@1.0.3"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
diff --git a/learn.json b/learn.json
index 8a811da..f8332ce 100644
--- a/learn.json
+++ b/learn.json
@@ -1,24 +1,28 @@
+
{
- "language": "python",
- "title": {
- "us": "Learn how to build HTTP requests with Python",
- "es": "Aprende a hacer requests HTTP con Python"
- },
- "slug": "python-http-requests-api-tutorial-exercises",
- "description": {
- "us": "Learn interactively to consume and create HTTP requests to APIs using Python",
- "es": "Aprende interactivamente cómo consumir APIs y hacer requests HTTP con Python"
- },
- "repository": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises",
- "duration": 4,
- "videoSolutions": false,
- "difficulty": "easy",
- "preview": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises/blob/master/preview.png?raw=true",
- "repository": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises",
- "projectType": "tutorial",
- "autoPlay": true,
- "bugsLink": "https://github.com/learnpack/learnpack/issues/new",
- "editor": {
- "version": "3.1.23"
- }
+"language": "python",
+"title": {
+ "us": "Learn how to build HTTP requests with Python",
+ "es": "Aprende a hacer requests HTTP con Python"
+},
+"slug": "python-http-requests-api-tutorial-exercises",
+"description": {
+ "us": "Learn interactively to consume and create HTTP requests to APIs using Python",
+ "es": "Aprende interactivamente cómo consumir APIs y hacer requests HTTP con Python"
+},
+"repository": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises",
+"duration": 4,
+"videoSolutions": false,
+"difficulty": "easy",
+"preview": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises/blob/master/preview.png?raw=true",
+"repository": "https://github.com/4GeeksAcademy/python-http-requests-api-tutorial-exercises",
+"projectType": "tutorial",
+"autoPlay": true,
+"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
+"editor": {
+ "version": "3.1.36"
+},
+"telemetry": {
+ "batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry"
+}
}
From 29ece1c63e589ac40be082b00c3c33ac249ab523 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Mon, 1 Jul 2024 17:36:18 -0500
Subject: [PATCH 19/27] Update learn.json
---
learn.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/learn.json b/learn.json
index f8332ce..69b7008 100644
--- a/learn.json
+++ b/learn.json
@@ -20,7 +20,7 @@
"autoPlay": true,
"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
"editor": {
- "version": "3.1.36"
+ "version": "3.1.40"
},
"telemetry": {
"batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry"
From fbb17237f1fc1e4e3dd63e57205612dc353541a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Mon, 1 Jul 2024 17:36:30 -0500
Subject: [PATCH 20/27] Update devcontainer.json
---
.devcontainer/devcontainer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 5893446..b45da3d 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -22,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.50 -g && learnpack plugins:install @learnpack/python@1.0.3"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.56 -g && learnpack plugins:install @learnpack/python@1.0.3"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
From e9b65012fbb2598c1007ac724958b5b8f0bacbdb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Thu, 26 Sep 2024 19:28:09 +0000
Subject: [PATCH 21/27] Add spanish videos and update pacakges
---
.devcontainer/devcontainer.json | 2 +-
exercises/00-welcome/README.es.md | 4 ++++
exercises/01-creating-a-request/README.es.md | 4 ++++
exercises/02-random-status/README.es.md | 4 ++++
exercises/03-response-body/README.es.md | 4 ++++
exercises/04-response-body-json/README.es.md | 4 ++++
exercises/05-project-name/README.es.md | 5 +++++
exercises/06-project-list/README.es.md | 4 ++++
exercises/07-project-list-image/README.es.md | 4 ++++
exercises/08-blog-post-author/README.es.md | 4 ++++
exercises/09-list-of-blog-titles/README.es.md | 4 ++++
exercises/10-get-post-tags/README.es.md | 4 ++++
exercises/11-get-attachment-by-id/README.es.md | 4 ++++
exercises/12-post-request/README.es.md | 4 ++++
exercises/13-post-request-body/README.es.md | 4 ++++
learn.json | 2 +-
16 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index b45da3d..15aec97 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -22,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@2.1.56 -g && learnpack plugins:install @learnpack/python@1.0.3"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@4.0.8 -g && learnpack plugins:install @learnpack/python@1.0.3"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
diff --git a/exercises/00-welcome/README.es.md b/exercises/00-welcome/README.es.md
index 51c6c3d..2f7fe62 100644
--- a/exercises/00-welcome/README.es.md
+++ b/exercises/00-welcome/README.es.md
@@ -1,3 +1,7 @@
+---
+intro: "https://www.youtube.com/watch?v=6H4Gn6-lpLI"
+---
+
# `00` Welcome to Python API Requests!
Python Requests es una herramienta potente y ampliamente utilizada para interactuar con APIs y realizar solicitudes HTTP en aplicaciones Python. Simplifica el proceso de enviar solicitudes HTTP y manejar respuestas, convirtiéndose en una herramienta favorita entre los desarrolladores para integrarse con servicios web y obtener datos de APIs.
diff --git a/exercises/01-creating-a-request/README.es.md b/exercises/01-creating-a-request/README.es.md
index 652d819..45431b5 100644
--- a/exercises/01-creating-a-request/README.es.md
+++ b/exercises/01-creating-a-request/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=eZ_5p3vyYFY"
+---
+
# `01` Creating a Request
Python tiene integrado un [paquete de solicitudes (*requests package*)](https://requests.readthedocs.io/en/master/) eso permite a los desarrolladores crear solicitudes HTTP con bastante facilidad.
diff --git a/exercises/02-random-status/README.es.md b/exercises/02-random-status/README.es.md
index e670821..0e9cbac 100644
--- a/exercises/02-random-status/README.es.md
+++ b/exercises/02-random-status/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=La95dYo4xOs"
+---
+
# `02` Handle Response Status
La siguiente solicitud GET siempre devuelve un código de status diferente, nunca se sabe qué respuesta está recibiendo del servidor.
diff --git a/exercises/03-response-body/README.es.md b/exercises/03-response-body/README.es.md
index 348bb72..325cd31 100644
--- a/exercises/03-response-body/README.es.md
+++ b/exercises/03-response-body/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=kQGUUW4ycDQ"
+---
+
# `03` Response Body
Haga clic en este enlace para ver la respuesta que esta solicitud GET está dando en el body:
diff --git a/exercises/04-response-body-json/README.es.md b/exercises/04-response-body-json/README.es.md
index 600a412..9e17bda 100644
--- a/exercises/04-response-body-json/README.es.md
+++ b/exercises/04-response-body-json/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=si3N6peHdjM"
+---
+
# `04` Response JSON
Pero tener una respuesta basada en texto no es muy útil, es por eso que las API normalmente responden en formato CSV, JSON, YAML o XML.
diff --git a/exercises/05-project-name/README.es.md b/exercises/05-project-name/README.es.md
index 002f6e1..8d98378 100644
--- a/exercises/05-project-name/README.es.md
+++ b/exercises/05-project-name/README.es.md
@@ -1,3 +1,8 @@
+---
+tutorial: "https://www.youtube.com/watch?v=sMA0NjIiVNs"
+---
+
+
# `05` Project name
El siguiente endpoint es ideal para recuperar proyectos de estudiantes:
diff --git a/exercises/06-project-list/README.es.md b/exercises/06-project-list/README.es.md
index d54db13..78b786c 100644
--- a/exercises/06-project-list/README.es.md
+++ b/exercises/06-project-list/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=S2qXbTLRyGA"
+---
+
# `06` Project List
El siguiente endpoint devuelve una respuesta en formato JSON con varios proyectos en una lista:
diff --git a/exercises/07-project-list-image/README.es.md b/exercises/07-project-list-image/README.es.md
index d155f02..31e2c31 100644
--- a/exercises/07-project-list-image/README.es.md
+++ b/exercises/07-project-list-image/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=U7vhqOETpqk"
+---
+
# `07` Project List Image
## 📝 Instrucciones:
diff --git a/exercises/08-blog-post-author/README.es.md b/exercises/08-blog-post-author/README.es.md
index 46037b0..223fa48 100644
--- a/exercises/08-blog-post-author/README.es.md
+++ b/exercises/08-blog-post-author/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=NZMkq0cIIlU"
+---
+
# `08` Post blog author
Tómate un momento para comprender el response body al hacer una solicitud GET a este endpoint:
diff --git a/exercises/09-list-of-blog-titles/README.es.md b/exercises/09-list-of-blog-titles/README.es.md
index 496528f..bb62401 100644
--- a/exercises/09-list-of-blog-titles/README.es.md
+++ b/exercises/09-list-of-blog-titles/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=SWgyGk3d3yk"
+---
+
# `09` List of blog titles
## 📝 Instrucciones:
diff --git a/exercises/10-get-post-tags/README.es.md b/exercises/10-get-post-tags/README.es.md
index cff0c68..aa00ec5 100644
--- a/exercises/10-get-post-tags/README.es.md
+++ b/exercises/10-get-post-tags/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=l9e-lSsYNOI"
+---
+
# `10` Get post tags
## 📝 Instrucciones:
diff --git a/exercises/11-get-attachment-by-id/README.es.md b/exercises/11-get-attachment-by-id/README.es.md
index 3b3ce59..b3cb472 100644
--- a/exercises/11-get-attachment-by-id/README.es.md
+++ b/exercises/11-get-attachment-by-id/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=TR0PYXJUEPY"
+---
+
# `11` Get attachment by id
## 📝 Instrucciones:
diff --git a/exercises/12-post-request/README.es.md b/exercises/12-post-request/README.es.md
index 13db050..5710393 100644
--- a/exercises/12-post-request/README.es.md
+++ b/exercises/12-post-request/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=1WsxHQ-_E1w"
+---
+
# `12` POST request
Las solicitudes POST están destinadas a la creación, por ejemplo, si tu negocio es un e-commerce de camisetas, es probable que desees tener una forma de agregar nuevos clientes.
diff --git a/exercises/13-post-request-body/README.es.md b/exercises/13-post-request-body/README.es.md
index 4360e54..87157b7 100644
--- a/exercises/13-post-request-body/README.es.md
+++ b/exercises/13-post-request-body/README.es.md
@@ -1,3 +1,7 @@
+---
+tutorial: "https://www.youtube.com/watch?v=x5k6pOmxmWc"
+---
+
# `13` POST request body
## 📝 Instrucciones:
diff --git a/learn.json b/learn.json
index 69b7008..6d2243d 100644
--- a/learn.json
+++ b/learn.json
@@ -20,7 +20,7 @@
"autoPlay": true,
"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
"editor": {
- "version": "3.1.40"
+ "version": "4.0.10"
},
"telemetry": {
"batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry"
From 5792b06cdae7f7ceb8f6810194e33a27f213273c Mon Sep 17 00:00:00 2001
From: Alejandro Sanchez
Date: Fri, 15 Nov 2024 14:32:23 -0500
Subject: [PATCH 22/27] Update learn.json
---
learn.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/learn.json b/learn.json
index 6d2243d..216c050 100644
--- a/learn.json
+++ b/learn.json
@@ -20,7 +20,7 @@
"autoPlay": true,
"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
"editor": {
- "version": "4.0.10"
+ "version": "4.0"
},
"telemetry": {
"batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry"
From 1674dbf32a81ac06ea7235da21c672ce67afec20 Mon Sep 17 00:00:00 2001
From: Alejandro Sanchez
Date: Wed, 15 Jan 2025 14:44:22 -0500
Subject: [PATCH 23/27] Update learn.json
---
learn.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/learn.json b/learn.json
index 216c050..031c69c 100644
--- a/learn.json
+++ b/learn.json
@@ -20,9 +20,9 @@
"autoPlay": true,
"bugsLink": "https://github.com/learnpack/learnpack/issues/new",
"editor": {
- "version": "4.0"
+ "version": "5.0"
},
"telemetry": {
- "batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry"
+ "batch": "https://breathecode.herokuapp.com/v1/assignment/me/telemetry?asset_id=1111"
}
}
From cb39361d6afcd186a4a16bd38375070250662ac8 Mon Sep 17 00:00:00 2001
From: Alejandro Sanchez
Date: Wed, 15 Jan 2025 14:44:38 -0500
Subject: [PATCH 24/27] Update devcontainer.json
---
.devcontainer/devcontainer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 15aec97..57fc02d 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -22,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@4.0.8 -g && learnpack plugins:install @learnpack/python@1.0.3"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@5.0.7 -g && learnpack plugins:install @learnpack/python@1.0.3"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
From 0bab0608b6885a935bfa598326747490ee8e9617 Mon Sep 17 00:00:00 2001
From: lorenagubaira <102861577+Lorenagubaira@users.noreply.github.com>
Date: Mon, 27 Jan 2025 20:29:40 -0400
Subject: [PATCH 25/27] Update devcontainer.json
---
.devcontainer/devcontainer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 57fc02d..633d5f8 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -22,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@5.0.7 -g && learnpack plugins:install @learnpack/python@1.0.3"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@5.0.13 -g && learnpack plugins:install @learnpack/python@1.0.6"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
From 9ea60a262333984a012682c1045fd71b3d2344c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charly=20Chac=C3=B3n?=
<107764250+Charlytoc@users.noreply.github.com>
Date: Sat, 1 Feb 2025 07:32:43 -0500
Subject: [PATCH 26/27] Update devcontainer.json
---
.devcontainer/devcontainer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 633d5f8..be8e469 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -22,7 +22,7 @@
"extensions": ["learn-pack.learnpack-vscode"]
}
},
- "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@5.0.13 -g && learnpack plugins:install @learnpack/python@1.0.6"
+ "onCreateCommand": "pip3 install pytest==6.2.5 pytest-testdox mock toml requests && npm i @learnpack/learnpack@5.0.19 -g && learnpack plugins:install @learnpack/python@1.0.6"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
From f90a785f2d248c29bf0fe9b35c392c53be8d805b Mon Sep 17 00:00:00 2001
From: GitHub Actions
Date: Fri, 28 Feb 2025 21:46:32 +0000
Subject: [PATCH 27/27] Update workflow files
---
.github/workflows/learnpack-audit.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/learnpack-audit.yml b/.github/workflows/learnpack-audit.yml
index 52644d8..95814c2 100644
--- a/.github/workflows/learnpack-audit.yml
+++ b/.github/workflows/learnpack-audit.yml
@@ -5,9 +5,9 @@ name: Learnpack audit
on:
push:
- branches: [ master ]
+ branches: [ main ]
pull_request:
- branches: [ master ]
+ branches: [ main ]
jobs:
build:
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
- node-version: [14.x]
+ node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: