iss-tracker-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- iss_tracker_cli-0.1.0/PKG-INFO +21 -0
- iss_tracker_cli-0.1.0/README.md +13 -0
- iss_tracker_cli-0.1.0/iss_tracker/__init__.py +0 -0
- iss_tracker_cli-0.1.0/iss_tracker/main.py +119 -0
- iss_tracker_cli-0.1.0/iss_tracker_cli.egg-info/PKG-INFO +21 -0
- iss_tracker_cli-0.1.0/iss_tracker_cli.egg-info/SOURCES.txt +10 -0
- iss_tracker_cli-0.1.0/iss_tracker_cli.egg-info/dependency_links.txt +1 -0
- iss_tracker_cli-0.1.0/iss_tracker_cli.egg-info/entry_points.txt +2 -0
- iss_tracker_cli-0.1.0/iss_tracker_cli.egg-info/requires.txt +1 -0
- iss_tracker_cli-0.1.0/iss_tracker_cli.egg-info/top_level.txt +1 -0
- iss_tracker_cli-0.1.0/pyproject.toml +16 -0
- iss_tracker_cli-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iss-tracker-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tool to track ISS position
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: requests
|
|
8
|
+
|
|
9
|
+
Simple cli tool for tracking the position of the ISS in real time!
|
|
10
|
+
|
|
11
|
+
commands include:
|
|
12
|
+
help - Lists all commands.
|
|
13
|
+
track {parameter}
|
|
14
|
+
{-t} - Returns position data for the ISS until interupted.
|
|
15
|
+
{[num]} - Returns position data for the ISS [num] times.
|
|
16
|
+
people - Returns the number of people that are currently in space.
|
|
17
|
+
|
|
18
|
+
Hope you like it! :)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
(this project uses open notify API)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Simple cli tool for tracking the position of the ISS in real time!
|
|
2
|
+
|
|
3
|
+
commands include:
|
|
4
|
+
help - Lists all commands.
|
|
5
|
+
track {parameter}
|
|
6
|
+
{-t} - Returns position data for the ISS until interupted.
|
|
7
|
+
{[num]} - Returns position data for the ISS [num] times.
|
|
8
|
+
people - Returns the number of people that are currently in space.
|
|
9
|
+
|
|
10
|
+
Hope you like it! :)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
(this project uses open notify API)
|
|
File without changes
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def getPeopData():
|
|
6
|
+
api = "http://api.open-notify.org/astros.json"
|
|
7
|
+
try:
|
|
8
|
+
raw_data = (requests.get(api, timeout = 5)).json()
|
|
9
|
+
except requests.exceptions.RequestException as e:
|
|
10
|
+
print(f"Error: {e}\n")
|
|
11
|
+
return None
|
|
12
|
+
|
|
13
|
+
num = raw_data["number"]
|
|
14
|
+
|
|
15
|
+
return num
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def getPosData():
|
|
19
|
+
api = "http://api.open-notify.org/iss-now.json"
|
|
20
|
+
try:
|
|
21
|
+
raw_data = (requests.get(api, timeout = 5)).json()
|
|
22
|
+
except requests.exceptions.RequestException as e:
|
|
23
|
+
print(f"Error: {e}\n")
|
|
24
|
+
return None
|
|
25
|
+
|
|
26
|
+
lat = raw_data["iss_position"]["latitude"]
|
|
27
|
+
lon = raw_data["iss_position"]["longitude"]
|
|
28
|
+
|
|
29
|
+
return (lat, lon)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def help():
|
|
33
|
+
return '''command list:
|
|
34
|
+
help - Lists all commands.
|
|
35
|
+
track {parameter}
|
|
36
|
+
{-t} - Returns position data for the ISS until interupted.
|
|
37
|
+
{[num]} - Returns position data for the ISS [num] times.
|
|
38
|
+
people - Returns the number of people that are currently in space.'''
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def track(par):
|
|
42
|
+
if par == "-t":
|
|
43
|
+
print("\n!Displaying Position Data for infinite requests.\n")
|
|
44
|
+
try:
|
|
45
|
+
while True:
|
|
46
|
+
data = getPosData()
|
|
47
|
+
if data != None:
|
|
48
|
+
lat, lon = data
|
|
49
|
+
print(f"------ISS position------\nLatitude: {lat}\nLongitude: {lon}\n")
|
|
50
|
+
time.sleep(1)
|
|
51
|
+
except KeyboardInterrupt:
|
|
52
|
+
print("\nExiting...\n")
|
|
53
|
+
else:
|
|
54
|
+
try:
|
|
55
|
+
t = int(par)
|
|
56
|
+
print(f"\n!Displaying Position Data for {t} request(s).\n")
|
|
57
|
+
for i in range(t):
|
|
58
|
+
data = getPosData()
|
|
59
|
+
if data != None:
|
|
60
|
+
lat, lon = data
|
|
61
|
+
print(f"------ISS position------\nLatitude: {lat}\nLongitude: {lon}\n")
|
|
62
|
+
time.sleep(1)
|
|
63
|
+
except TypeError as e:
|
|
64
|
+
print("Error: Incorrect parammeters")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def people():
|
|
68
|
+
data = getPeopData()
|
|
69
|
+
if data != None:
|
|
70
|
+
print(f"\nThere are currently {data} people in space!\n")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
#Main Programme
|
|
74
|
+
def main():
|
|
75
|
+
print('''\033[34m
|
|
76
|
+
ooo
|
|
77
|
+
/ : \\
|
|
78
|
+
_____"~~~~~"_____
|
|
79
|
+
\\+##|U *^* U|##+/
|
|
80
|
+
\\..!('ISS')!../
|
|
81
|
+
^--o| |o--^
|
|
82
|
+
+====}:^ ^ ^:{====+
|
|
83
|
+
___. .| ! |. .___
|
|
84
|
+
|####:/" " "\\:####|
|
|
85
|
+
|####=| O |=####|
|
|
86
|
+
|####>\\_____/<####|
|
|
87
|
+
‾‾‾˙ | | ˙‾‾‾
|
|
88
|
+
o o
|
|
89
|
+
\033[0m
|
|
90
|
+
* ISS Position Tracker *
|
|
91
|
+
''')
|
|
92
|
+
|
|
93
|
+
while True:
|
|
94
|
+
try:
|
|
95
|
+
command = input(">").lstrip()
|
|
96
|
+
|
|
97
|
+
#help command
|
|
98
|
+
if command.strip() == "help":
|
|
99
|
+
print(help())
|
|
100
|
+
|
|
101
|
+
#track command
|
|
102
|
+
elif command[:5] == "track":
|
|
103
|
+
par = command[5:].strip()
|
|
104
|
+
if par == "":
|
|
105
|
+
par = 1
|
|
106
|
+
track(par)
|
|
107
|
+
|
|
108
|
+
elif command.strip() == "people":
|
|
109
|
+
people()
|
|
110
|
+
|
|
111
|
+
#invalid command
|
|
112
|
+
else:
|
|
113
|
+
print("!Invalid command. Enter 'help' to display command list.")
|
|
114
|
+
except KeyboardInterrupt:
|
|
115
|
+
print("\nExiting...\n")
|
|
116
|
+
break
|
|
117
|
+
|
|
118
|
+
if __name__ == "__main__":
|
|
119
|
+
main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iss-tracker-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tool to track ISS position
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: requests
|
|
8
|
+
|
|
9
|
+
Simple cli tool for tracking the position of the ISS in real time!
|
|
10
|
+
|
|
11
|
+
commands include:
|
|
12
|
+
help - Lists all commands.
|
|
13
|
+
track {parameter}
|
|
14
|
+
{-t} - Returns position data for the ISS until interupted.
|
|
15
|
+
{[num]} - Returns position data for the ISS [num] times.
|
|
16
|
+
people - Returns the number of people that are currently in space.
|
|
17
|
+
|
|
18
|
+
Hope you like it! :)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
(this project uses open notify API)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
iss_tracker/__init__.py
|
|
4
|
+
iss_tracker/main.py
|
|
5
|
+
iss_tracker_cli.egg-info/PKG-INFO
|
|
6
|
+
iss_tracker_cli.egg-info/SOURCES.txt
|
|
7
|
+
iss_tracker_cli.egg-info/dependency_links.txt
|
|
8
|
+
iss_tracker_cli.egg-info/entry_points.txt
|
|
9
|
+
iss_tracker_cli.egg-info/requires.txt
|
|
10
|
+
iss_tracker_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
iss_tracker
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "iss-tracker-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI tool to track ISS position"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"requests"
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
iss-tracker = "iss_tracker.main:main"
|