File tree Expand file tree Collapse file tree 4 files changed +39
-5
lines changed Expand file tree Collapse file tree 4 files changed +39
-5
lines changed Original file line number Diff line number Diff line change
1
+ import requests
2
+
3
+ def get_titles ():
4
+ # Your code here
5
+ return None
6
+
7
+
8
+ print (get_titles ())
Original file line number Diff line number Diff line change
1
+ import requests
2
+
3
+ def get_post_tags (post_id ):
4
+ # Your code here
5
+ return None
6
+
7
+
8
+ print (get_post_tags (146 ))
Original file line number Diff line number Diff line change 1
1
import requests
2
2
3
- # Your code here
3
+ # Your code here
4
+ url = "https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php"
5
+ response = requests .get (url )
6
+ data = response .json ()
7
+
8
+ # Getting the first post
9
+ first_post = data ["posts" ][0 ]
10
+
11
+ # Getting the author dictionary
12
+ author_dict = first_post ["author" ]
13
+
14
+ # Getting the author name
15
+ author_name = author_dict ["name" ]
16
+
17
+ print (author_name )
Original file line number Diff line number Diff line change 1
1
import requests
2
2
3
- def get_titles ():
3
+ def get_titles (web_page ):
4
4
# Your code here
5
- return None
5
+ titles = []
6
+ response = requests .get (url )
7
+ data = response .json ()
8
+ post = data ["posts" ]
9
+ return post
6
10
7
-
8
- print (get_titles ())
11
+ url = "https://assets.breatheco.de/apis/fake/sample/weird_portfolio.php"
12
+ print (get_titles (url ))
You can’t perform that action at this time.
0 commit comments