We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 653863d commit a1b1366Copy full SHA for a1b1366
1 file changed
Python_rest_data_process.py
@@ -0,0 +1,20 @@
1
+import json
2
+import requests
3
+person_ISS=[]
4
+person_Tiangong=[]
5
+def space_data(url):
6
+ data = requests.get(url)
7
+ # print(data.json())
8
+ dump = data.json()
9
+ for person in dump["people"]:
10
+ print(person["craft"])
11
+ if (person["craft"] == "ISS"):
12
+ person_ISS.append(person["name"])
13
+ else:
14
+ person_Tiangong.append(person["name"])
15
+
16
17
+ print("Total number of persons in ISS" +" "+ str(len(person_ISS)))
18
+ print("Total number of persons in ISS" +" "+ str(len(person_Tiangong)))
19
20
+space_data("http://api.open-notify.org/astros.json")
0 commit comments