Skip to content

Spanish Translate #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .breathecode/resets/01-what-is-a-request/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import requests

url = "https://assets.breatheco.de/apis/fake/sample/404-example.php"
response = requests.get(url)

print("The response status is: "+str(response.status_code))
3 changes: 3 additions & 0 deletions .breathecode/resets/02-random-status/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

response = requests.get("https://assets.breatheco.de/apis/fake/sample/random-status.php")
3 changes: 3 additions & 0 deletions .breathecode/resets/03-response-body/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
4 changes: 4 additions & 0 deletions .breathecode/resets/04-response-body-json/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import requests

response = requests.get("https://assets.breatheco.de/apis/fake/sample/time.php")
print(response.text)
3 changes: 3 additions & 0 deletions .breathecode/resets/05-project-name/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

# your code here
3 changes: 3 additions & 0 deletions .breathecode/resets/06-project-list/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

# your code here
3 changes: 3 additions & 0 deletions .breathecode/resets/07-project-list-image/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

# your code here
3 changes: 3 additions & 0 deletions .breathecode/resets/08-blog-post-author/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

# your code here
5 changes: 5 additions & 0 deletions .breathecode/resets/09-array-of-blog-titles/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import requests

def get_titles():
# your code here
return None
8 changes: 8 additions & 0 deletions .breathecode/resets/10-get_post_tags/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import requests

def get_post_tags(post_id):
# your code here
return None


print(get_post_tags(146))
7 changes: 7 additions & 0 deletions .breathecode/resets/11-get_attachment_by_id/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import requests

def get_attachment_by_id(attachment_id):
# your code here
return None

print(get_attachment_by_id(137))
3 changes: 3 additions & 0 deletions .breathecode/resets/12-post-request/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import requests

# your code here
4 changes: 4 additions & 0 deletions .breathecode/resets/13-post-request-body/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import requests

resp = requests.post("https://assets.breatheco.de/apis/fake/sample/save-project-json.php")
print(resp.text)
149 changes: 148 additions & 1 deletion bc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,150 @@
{
"language": "python3"
"port": 3000,
"address": "localhost",
"editor": "gitpod",
"outputPath": "./.breathecode/dist",
"publicPath": "/preview",
"grading": "isolated",
"ignoreRegex": null,
"webpack_template": null,
"disable_grading": false,
"onCompilerSuccess": null,
"language": "python3",
"compiler": "python3",
"tester": "pytest",
"actions": [
"run",
"test",
"reset"
],
"session": 3445355432462036000,
"exercisesPath": "./exercises",
"exercises": [
{
"slug": "01-hello-world",
"title": "01-hello-world",
"path": "exercises/01-hello-world",
"translations": [
"es",
"us"
]
},
{
"slug": "01-what-is-a-request",
"title": "01-what-is-a-request",
"path": "exercises/01-what-is-a-request",
"translations": [
"es",
"us"
]
},
{
"slug": "02-random-status",
"title": "02-random-status",
"path": "exercises/02-random-status",
"translations": [
"es",
"us"
]
},
{
"slug": "03-response-body",
"title": "03-response-body",
"path": "exercises/03-response-body",
"translations": [
"es",
"us"
]
},
{
"slug": "04-response-body-json",
"title": "04-response-body-json",
"path": "exercises/04-response-body-json",
"translations": [
"es",
"us"
]
},
{
"slug": "05-project-name",
"title": "05-project-name",
"path": "exercises/05-project-name",
"translations": [
"es",
"us"
]
},
{
"slug": "06-project-list",
"title": "06-project-list",
"path": "exercises/06-project-list",
"translations": [
"es",
"us"
]
},
{
"slug": "07-project-list-image",
"title": "07-project-list-image",
"path": "exercises/07-project-list-image",
"translations": [
"es",
"us"
]
},
{
"slug": "08-blog-post-author",
"title": "08-blog-post-author",
"path": "exercises/08-blog-post-author",
"translations": [
"es",
"us"
]
},
{
"slug": "09-array-of-blog-titles",
"title": "09-array-of-blog-titles",
"path": "exercises/09-array-of-blog-titles",
"translations": [
"es",
"us"
]
},
{
"slug": "10-get_post_tags",
"title": "10-get_post_tags",
"path": "exercises/10-get_post_tags",
"translations": [
"es",
"us"
]
},
{
"slug": "11-get_attachment_by_id",
"title": "11-get_attachment_by_id",
"path": "exercises/11-get_attachment_by_id",
"translations": [
"es",
"us"
]
},
{
"slug": "12-post-request",
"title": "12-post-request",
"path": "exercises/12-post-request",
"translations": [
"es",
"us"
]
},
{
"slug": "13-post-request-body",
"title": "13-post-request-body",
"path": "exercises/13-post-request-body",
"translations": [
"es",
"us"
]
}
]
}
13 changes: 13 additions & 0 deletions exercises/01-hello-world/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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.
20 changes: 20 additions & 0 deletions exercises/01-what-is-a-request/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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('<destination url>')
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.
14 changes: 14 additions & 0 deletions exercises/02-random-status/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# `02` Manejar el Status de Respuesta

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

## 📝Instrucciones

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

| Status | Message |
| ----- | ----- |
| 404 | The URL you asked is not found |
| 503 | Unavailable right now |
| 200 | Everything went perfect |
| 400 | Something is wrong on the request params |
14 changes: 14 additions & 0 deletions exercises/03-response-body/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# `03` Respuesta en 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:
```py
# plain text
print(response.text)
```

# 📝 Instrucciones

Imprime en la consola la the responde body solo para solicitudes 200, para el resto imprima "Something went wrong".
36 changes: 36 additions & 0 deletions exercises/04-response-body-json/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# `04` Respuesta 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

El siguiente endpoint devuelve la hora actual en un formato JSON cada vez que se solicita utilizando el método GET.

| | |
| --- | --- |
| method | GET |
| endpoint | https://assets.breatheco.de/apis/fake/sample/time.php |
| content-type | application/json |

Response body:

```python
{
"hours": "07",
"minutes": "29",
"seconds": "35"
}
```

Haga una solicitud GET a ese endpoint e imprima la hora en la consola con este formato:

```bash
Current time: 17 hrs 06 min and 23 sec
```

## 💡Pista

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`

36 changes: 36 additions & 0 deletions exercises/05-project-name/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# `05` Nombre de Proyecto

El siguiente endpoint es ideal para recuperar proyectos de estudiantes:

GET [https://assets.breatheco.de/apis/fake/sample/project1.php](https://assets.breatheco.de/apis/fake/sample/project1.php)

```json
{
"name": "Coursera eLearning",
"thumb": "https://unsplash.it/450/320?image=178",
"description": "The coolest elarning site on the planet",
"images": [
"https://unsplash.it/450/320?image=178",
"https://unsplash.it/450/320?image=179",
"https://unsplash.it/450/320?image=180",
"https://unsplash.it/450/320?image=181"
]
}
```

# 📝 Instrucciones

Llama al endpoint e imprime el nombre del proyecto en el terminal (solo el nombre del proyecto)

Example output:
```bash
Coursera eLearning
```

## 💡Pista

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.

Loading