Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 81e9aeb

Browse files
todos los ejercicios
2 parents 855aa82 + 8e299a4 commit 81e9aeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+595
-308
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
!/exercises
1616
!/exercises/*
17+
exercises/*/__pycache__/
1718

1819
!/.learn
1920
/.learn/**

‎exercises/00-welcome/README.es.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# `00` Welcome to Python API Requests!
2+
3+
Python Requests es el paquete más popular para consumir APIs y hacer solicitudes HTTP.
4+
5+
Aquí aprenderás:
6+
7+
1. Cómo hacer solicitudes GET.
8+
2. Cómo obtener propiedades de datos e información.
9+
3. Cómo configurar request headers.
10+
4. Cómo configurar request content-type.
11+
5. Cómo hacer solicitudes POST.
12+
13+
Haga clic en el botón `Next →` en la esquina superior derecha para continuar.

‎exercises/00-welcome/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# `00` Welcome to Python API Requests!
2+
3+
Python Requests is the most popular package for consuming APIs and doing HTTP requests.
4+
5+
Here you will learn:
6+
7+
1. How to do GET requests.
8+
2. How to fetch data properties and information.
9+
3. How to set request headers.
10+
4. How to set request content-type.
11+
5. How to do POST requests.
12+
13+
Click the `Next →` button on the top right to continue.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# `01` Creating a Request
2+
3+
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:
15+
16+
```bash
17+
https://assets.breatheco.de/apis/fake/sample/hello.php
18+
```
19+
20+
> Nota: La consola debe imprimir un código de estado 200.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 01 Creating a request
1+
# `01` Creating a Request
22

33
Python has a [requests package](https://requests.readthedocs.io/en/master/) that allows developers to create HTTP request pretty easily.
44

@@ -9,12 +9,12 @@ response = requests.get('<destination url>')
99
print(response.status_code)
1010
```
1111

12-
# 📝 Instructions
12+
## 📝 Instructions:
1313

14-
Change the variable urlto make it request to:
14+
Update the `url` variable to make it request to this address:
1515

16-
```bash
16+
```text
1717
https://assets.breatheco.de/apis/fake/sample/hello.php
1818
```
1919

20-
Note: The console should print a 200 status code.
20+
> Note: The console should print a 200 status code.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import requests
2+
3+
url = "https://assets.breatheco.de/apis/fake/sample/hello.php"
4+
response = requests.get(url)
5+
6+
print("The response status is: "+str(response.status_code))

‎exercises/02-random-status/README.es.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# `02` Manejar el Status de Respuesta
1+
# `02` Handle Response Status
22

33
La siguiente solicitud GET siempre devuelve un código de status diferente, nunca se sabe qué respuesta está recibiendo del servidor.
44

5-
## 📝Instrucciones
5+
## 📝Instrucciones:
66

77
Crea una condición para imprimir en la consola los siguientes mensajes según el status de respuesta:
88

9-
| Status | Message |
9+
| Status | Mensaje |
1010
| ----- | ----- |
11-
| 404 | The URL you asked is not found |
11+
| 404 | The URL you asked for is not found |
1212
| 503 | Unavailable right now |
1313
| 200 | Everything went perfect |
14-
| 400 | Something is wrong on the request params |
14+
| 400 | Something is wrong with the request params |
15+
| Otro código de status | Unknown status code |

‎exercises/02-random-status/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# `02` Handle Response Status
22

3-
The following GET request is always returning a different status code, you never know what reponse you are getting form the server.
3+
The following GET request is always returning a different status code; you never know what response you are getting from the server.
44

5-
## 📝Instructions
5+
## 📝Instructions:
66

7-
Create a condition to print on the console the following messages depending on the response status:
7+
Create a condition to print on the console the following messages, depending on the response status:
88

99
| Status | Message |
1010
| ----- | ----- |
11-
| 404 | The URL you asked is not found |
11+
| 404 | The URL you asked for is not found |
1212
| 503 | Unavailable right now |
1313
| 200 | Everything went perfect |
14-
| 400 | Something is wrong on the request params |
15-
| anything else | anything |
14+
| 400 | Something is wrong with the request params |
15+
| Any other code | Unknown status code |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /