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
Please do a GET request to that endpoint and print what the time on the console with this format:
25
+
Please do a GET request to that endpoint and print the time on the console with this format:
22
26
23
27
```bash
24
28
Current time: 17 hrs 06 min and 23 sec
25
29
```
26
30
27
31
## 💡Hint
28
32
29
-
1. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary
30
-
2. Get the `hours`, `minutes` and `seconds` properties from the object
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
31
35
3. Concatenate everything together like this: `Current time: 17 hrs 06 min and 23 sec`
The following endpoint is ideal to retrieve student projects:
4
+
5
+
GET [https://assets.breatheco.de/apis/fake/sample/project1.php](https://assets.breatheco.de/apis/fake/sample/project1.php)
5
6
6
7
```json
7
8
{
@@ -21,13 +22,15 @@ The following endpoint is ideal to retrieve student projects:
21
22
22
23
Please call the endpoint and print the project name on the terminal (only the project name)
23
24
25
+
Example output:
24
26
```bash
25
27
Coursera eLearning
26
28
```
27
29
28
30
## 💡Hint
29
31
30
-
1. Do a GET request to the endpoint.
31
-
2. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
32
-
3. Print the project name, you can access the property name on the response dictionary.
32
+
1. Similar exercise to the previous one.
33
+
2. Do a GET request to the endpoint.
34
+
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).
35
+
4. Print the project name, you can access the property name on the response dictionary.
Each of the projects has the following format (example):
7
8
```json
@@ -20,7 +21,7 @@ Each of the projects has the following format (example):
20
21
21
22
# 📝 Instructions
22
23
23
-
Please call the endpoint and print the name of the SECOND project on the list:
24
+
Please call the endpoint and print the name of the **SECOND** project on the list:
24
25
25
26
Example output:
26
27
```bash
@@ -29,9 +30,11 @@ Coursera eLearning
29
30
30
31
## 💡Hint
31
32
32
-
1. Do a GET request to the endpoint.
33
-
2. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
34
-
3. Find the second project on the list.
35
-
4. Print the project name, you can access the property name of the project dictionary.
36
-
5. You don't need to loop, just access the second item like a list using the position
33
+
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.
34
+
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.
35
+
2. Do a GET request to the endpoint.
36
+
3. Use the [.json() method](https://www.w3schools.com/python/ref_requests_response.asp) to get the response body as a dictionary.
37
+
4. Find the second project on the list.
38
+
5. Print the project name, you can access the property name of the project dictionary.
39
+
6. You don't need to loop, just access the second item like a list using the position
0 commit comments