You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
+
5
+
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.
6
+
7
+
Aquí aprenderás:
8
+
9
+
1. ¿Cómo hacer solicitudes GET?
10
+
2. ¿Cómo obtener propiedades de datos e información?
11
+
3. ¿Cómo configurar request headers?
12
+
4. ¿Cómo configurar request content-type?
13
+
5. ¿Cómo hacer solicitudes POST?
14
+
15
+
Haga clic en el botón `Next →` en la esquina superior derecha para continuar.
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.
4
+
5
+
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.
6
+
7
+
Here you will learn:
8
+
9
+
1. How to do GET requests?
10
+
2. How to fetch data properties and information?
11
+
3. How to set request headers?
12
+
4. How to set request content-type?
13
+
5. How to do POST requests?
14
+
15
+
Click the `Next →` button on the top right to continue.
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.
4
+
5
+
Así es como en Python hacemos una solicitud HTTP GET:
6
+
7
+
```python
8
+
response = requests.get('<destination url>')
9
+
print(response.status_code)
10
+
```
11
+
12
+
## 📝 Instrucciones:
13
+
14
+
Actualiza la variable `url` para que solicite a esta dirección:
Copy file name to clipboardExpand all lines: exercises/04-response-body-json/README.es.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# `04`Respuesta JSON
1
+
# `04`Response JSON
2
2
3
3
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.
4
4
5
-
# 📝 Instrucciones
5
+
##📝 Instrucciones:
6
6
7
7
El siguiente endpoint devuelve la hora actual en un formato JSON cada vez que se solicita utilizando el método GET.
8
8
@@ -22,15 +22,15 @@ Response body:
22
22
}
23
23
```
24
24
25
-
Haga una solicitud GET a ese endpoint e imprima la hora en la consola con este formato:
25
+
1. Haz una solicitud GET a ese endpoint e imprime la hora en la consola con este formato:
26
26
27
27
```bash
28
28
Current time: 17 hrs 06 min and 23 sec
29
29
```
30
30
31
-
## 💡Pista
31
+
## 💡 Pistas:
32
32
33
-
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
34
-
2. Obtenga las propiedades `horas`,` minutos` y `segundos` del diccionario
35
-
3. Concatenar todo de esta manera: `Hora actual: 17 h 06 min y 23 seg`
33
+
+ 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.
34
+
+ Obtenga las propiedades `hours`, `minutes` y `seconds` del diccionario.
35
+
+ Concatenar todo de esta manera: `Hora actual: 17 h 06 min y 23 seg`.
Copy file name to clipboardExpand all lines: exercises/04-response-body-json/README.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# `04` Response JSON
2
2
3
-
But having a text based response is not very useful, that is why API's normally respond in CSV, JSON, YAML or XML format.
3
+
But having a text based response is not very useful, that is why APIs normally respond in CSV, JSON, YAML or XML format.
4
4
5
-
# 📝 Instructions
5
+
##📝 Instructions:
6
6
7
7
The following endpoint returns the current time in a JSON format every time it is requested using the GET method.
8
8
@@ -22,15 +22,15 @@ Response body:
22
22
}
23
23
```
24
24
25
-
Please do a GET request to that endpoint and print the time on the console with this format:
25
+
1.Please do a GET request to that endpoint and print the time on the console with this format:
26
26
27
-
```bash
27
+
```text
28
28
Current time: 17 hrs 06 min and 23 sec
29
29
```
30
30
31
-
## 💡Hint
31
+
## 💡 Hints:
32
32
33
-
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
34
-
2. Get the `hours`, `minutes` and `seconds` properties from the dictionary
35
-
3. Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`
33
+
+ 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.
34
+
+ Get the `hours`, `minutes` and `seconds` properties from the dictionary.
35
+
+ Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`.
0 commit comments