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
HTTP is a set of rules that allow two endpoints A - B to communicate with each other in only one direction:
4
+
```txt
5
+
A = Client B = Server
6
+
```
7
+
8
+
- The client always asks a `request` to one server URL.
9
+
- The server wais for request and answers max one `response` for each request.
10
+
11
+
In python this is how we make a request:
12
+
13
+
```python
14
+
from http.client import HTTPSConnection
15
+
16
+
host_url ="assets.breatheco.de"
17
+
path ="/apis/fake/hello.php"
18
+
19
+
conn = HTTPSConnection(host_url)
20
+
conn.request("GET", path, body=None, headers={})
21
+
22
+
r1 = conn.getresponse()
23
+
response = {
24
+
"status": r1.status,
25
+
"body": r1.read()
26
+
}
27
+
28
+
print(response)
29
+
```
30
+
31
+
# 📝 Instructions
32
+
33
+
Change the following code to print on the console `success` if the response status is between 200 and 399 or `fail` if the response is between 400 and 599.
34
+
35
+
Note: Only print success or fail, do not print anything else.
0 commit comments