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 44c6f29

Browse files
Add exercises
1 parent fbb1723 commit 44c6f29

File tree

16 files changed

+81
-6
lines changed

16 files changed

+81
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import requests
2+
3+
url = "https://assets.breatheco.de/apis/fake/sample/404-example.php"
4+
# url = "https://assets.breatheco.de/apis/fake/sample/hello.php"
5+
response = requests.get(url)
6+
7+
print("The response status is: "+str(response.status_code))

‎.learn/resets/02-random-status/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import requests
2+
3+
response = requests.get("https://assets.breatheco.de/apis/fake/sample/random-status.php")

‎.learn/resets/03-response-body/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import requests
2+
3+
url = "https://assets.breatheco.de/apis/fake/sample/random-status.php"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import requests
2+
3+
response = requests.get("https://assets.breatheco.de/apis/fake/sample/time.php")
4+
print(response.text)

‎.learn/resets/05-project-name/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import requests
2+
3+
# Your code here

‎.learn/resets/06-project-list/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import requests
2+
3+
# Your code here
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import requests
2+
3+
# Your code here
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import requests
2+
3+
# Your code here

‎exercises/01-creating-a-request/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import requests
22

3-
url = "https://assets.breatheco.de/apis/fake/sample/404-example.php"
3+
url = "https://assets.breatheco.de/apis/fake/sample/hello.php"
44
# url = "https://assets.breatheco.de/apis/fake/sample/hello.php"
55
response = requests.get(url)
66

‎exercises/02-random-status/app.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
import requests
22

33
response = requests.get("https://assets.breatheco.de/apis/fake/sample/random-status.php")
4+
5+
if response.status_code == 404:
6+
print("The URL you asked for is not found")
7+
8+
elif response.status_code == 503:
9+
print("Unavailable right now")
10+
11+
elif response.status_code == 200:
12+
print("Everything went perfect")
13+
14+
elif response.status_code == 400:
15+
print("Something is wrong with the request params")
16+
17+
else:
18+
print("Unknown status code")

0 commit comments

Comments
(0)

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