-
Notifications
You must be signed in to change notification settings - Fork 1
/
RocketLaunch.py
executable file
·69 lines (61 loc) · 1.69 KB
/
RocketLaunch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
# Developer : Hamdy Abou El Anein
# hamdy.aea@protonmail.com
# This Python3 software print in the terminal the next rockets launch. The data is updated at every run.
from urllib.request import Request, urlopen
import json
def main():
req = Request("https://astrometry.ch/rockets.json", headers={'User-Agent': 'Mozilla/5.0'})
data = urlopen(req,timeout=10).read()
Rocketlaunch = json.loads(data.decode())
for i in Rocketlaunch["results"]:
try:
spacecraft = i["rocket"]["configuration"]["full_name"]
except:
spacecraft = ""
try:
type = i["launch_service_provider"]["type"]
except:
type = ""
try:
time = i["net"]
except:
time = ""
try:
company = i["launch_service_provider"]["name"]
except:
company = ""
try:
pic = i["image"]
except:
pic = ""
try:
mission1 = i["mission"]["name"]
except:
mission1 = ""
try:
description = i["mission"]["description"]
except:
description = ""
try:
type = i["mission"]["type"]
except:
type = ""
try:
orbit = i["mission"]["orbit"]["name"]
except:
orbit = ""
print(spacecraft)
print(type)
print(time)
print(company)
print(pic)
print(mission1)
print(description)
print(type)
print(orbit)
print("\n")
num = Rocketlaunch["count"]
print("Number of Rockets")
print(num)
main()