n2yo-api-wrapper 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl

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.
n2yo/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  __title__ = "n2yo-api-wrapper"
2
- __version__ = "0.0.1"
2
+ __version__ = "0.0.2"
3
3
  __author__ = "Giampy"
4
4
  __license__ = "MIT"
5
5
 
n2yo/exceptions.py CHANGED
@@ -1,2 +1,8 @@
1
- class InvalidApiKey(Exception):
1
+ class N2YOInvalidKeyException(Exception):
2
+ pass
3
+
4
+ class N2YORateLimitException(Exception):
5
+ pass
6
+
7
+ class N2YOAPIException(Exception):
2
8
  pass
n2yo/n2yo.py CHANGED
@@ -2,7 +2,7 @@ import logging, requests
2
2
  from dacite import from_dict
3
3
 
4
4
  from .models.search import TleData, SatellitePositionsData, VisualPassesData, RadioPassesData, SatellitesAboveData
5
- from .exceptions import InvalidApiKey
5
+ from .exceptions import N2YOInvalidKeyException
6
6
 
7
7
 
8
8
  # Set up logging - datetime format, level, and format
@@ -55,7 +55,7 @@ class n2yo:
55
55
  data = response.json()
56
56
 
57
57
  if data.get("error") == "Invalid API Key!":
58
- raise InvalidApiKey("The API key is invalid or missing.")
58
+ raise N2YOInvalidKeyException("The API key is invalid or missing.")
59
59
 
60
60
  result = from_dict(data_class=TleData, data=data)
61
61
  return result
@@ -101,7 +101,7 @@ class n2yo:
101
101
  data = response.json()
102
102
 
103
103
  if data.get("error") == "Invalid API Key!":
104
- raise InvalidApiKey("The API key is invalid or missing.")
104
+ raise N2YOInvalidKeyException("The API key is invalid or missing.")
105
105
 
106
106
  result = from_dict(data_class=SatellitePositionsData, data=data)
107
107
  return result
@@ -157,7 +157,7 @@ class n2yo:
157
157
  data = response.json()
158
158
 
159
159
  if data.get("error") == "Invalid API Key!":
160
- raise InvalidApiKey("The API key is invalid or missing.")
160
+ raise N2YOInvalidKeyException("The API key is invalid or missing.")
161
161
 
162
162
  result = from_dict(data_class=VisualPassesData, data=data)
163
163
  return result
@@ -209,7 +209,7 @@ class n2yo:
209
209
  data = response.json()
210
210
 
211
211
  if data.get("error") == "Invalid API Key!":
212
- raise InvalidApiKey("The API key is invalid or missing.")
212
+ raise N2YOInvalidKeyException("The API key is invalid or missing.")
213
213
 
214
214
  result = from_dict(data_class=RadioPassesData, data=data)
215
215
  return result
@@ -257,7 +257,7 @@ class n2yo:
257
257
  data = response.json()
258
258
 
259
259
  if data.get("error") == "Invalid API Key!":
260
- raise InvalidApiKey("The API key is invalid or missing.")
260
+ raise N2YOInvalidKeyException("The API key is invalid or missing.")
261
261
 
262
262
  result = from_dict(data_class=SatellitesAboveData, data=data)
263
263
 
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.1
2
+ Name: n2yo-api-wrapper
3
+ Version: 0.0.2
4
+ Summary: Unofficial Wrapper for N2YO.com API
5
+ Home-page: https://github.com/g1ampy/n2yo-api-wrapper
6
+ Author: Giampy
7
+ Author-email: g1ampy@proton.me
8
+ License: MIT
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: requests
18
+ Requires-Dist: dacite
19
+ Requires-Dist: beautifulsoup4
20
+
21
+ <div align='center'>
22
+ <img src='readme/icon.png' width='200'/>
23
+ <h2>🛰️ N2YO.com Python API Wrapper</h2>
24
+ </div>
25
+
26
+ <p align='center'>
27
+ <p align='center'>
28
+ <a href='https://github.com/g1ampy/n2yo-api-wrapper/stargazers'><img alt='Stars' src='https://img.shields.io/github/stars/g1ampy/n2yo-api-wrapper?color=blue'/></a>
29
+ <a href='https://github.com/g1ampy/n2yo-api-wrapper/forks'><img alt='Forks' src='https://img.shields.io/github/forks/g1ampy/n2yo-api-wrapper?color=blue'/></a>
30
+ <a href='https://github.com/g1ampy/n2yo-api-wrapper/releases'><img alt='GitHub release' src='https://img.shields.io/github/v/release/g1ampy/n2yo-api-wrapper?color=blue'/></a>
31
+ <a href='https://github.com/g1ampy/n2yo-api-wrapper/blob/main/LICENSE'><img alt='License' src='https://img.shields.io/github/license/g1ampy/n2yo-api-wrapper?color=blue'/></a>
32
+ <a href='https://pypi.org/project/n2yo-api.wrapper/'><img alt='PyPI' src='https://img.shields.io/pypi/v/n2yo-api-wrapper?color=blue'></a>
33
+ </p>
34
+ </p>
35
+
36
+
37
+ <p align='center'> A lightweight, feature-complete Python interface for satellite tracking using N2YO.com's API </p>
38
+
39
+ ### 🛰️ About The Project
40
+
41
+ A Pythonic interface for accessing real-time satellite data from [N2YO.com](https://www.n2yo.com/api/). This wrapper simplifies interactions with the N2YO API by handling authentication, request formatting, error handling, and response parsing - transforming JSON payloads into native Python objects.
42
+
43
+
44
+ ### ✨ Key Features
45
+ - **Real-time Satellite Tracking**: Get current position and trajectory data
46
+ - **Pass Prediction**: Calculate visible passes for any location
47
+ - **TLE Data Access**: Retrieve latest orbital parameters
48
+ - **Satellite Search**: Find satellites by name/category
49
+ - **Type Annotations**: Full IDE support and type safety
50
+
51
+ ### ⚙️ Installation
52
+ ```bash
53
+ pip install n2yo-api-wrapper
54
+ ```
55
+
56
+ ### 🔑 API Key Setup
57
+ 1. **Get a free API key from N2YO.com**
58
+ 2. **Setup client**
59
+ ```python
60
+ from n2yo import n2yo
61
+ client = n2yo(api_key="YOUR_API_KEY")'
62
+ ```
63
+
64
+ ### 🚀 Usage Examples
65
+
66
+ ```python
67
+ from n2yo import n2yo
68
+
69
+ # Initialize client
70
+ client = n2yo(api_key="YOUR_API_KEY")
71
+
72
+ # Get satellite positions
73
+ positions = client.get_satellite_positions(25544, 41.702, -76.014, 500, 10)
74
+
75
+ # Predict visible passes
76
+ passes = client.get_visual_passes(25544, 41.702, -76.014, 500, 3)
77
+
78
+ # Retrieve TLE data
79
+ tle = client.get_tle(25544)
80
+
81
+ # Return all objects within a given search radius above observer's location
82
+ above = client.get_above(41.702, -76.014, 0, 70, 18)
83
+ ```
84
+
85
+ ### 📜 Error Handling
86
+ - **N2YOInvalidKeyException:** Invalid API key.
87
+ ```python
88
+ try:
89
+ data = client.get_positions(...)
90
+ except N2YOInvalidKeyException:
91
+ print("Invalid API key configured")
92
+ ```
93
+
94
+ ### 📚 Full Method Reference
95
+ [Please refer to the full documentation](https://www.n2yo.com/api/)
96
+
97
+ ### 📃 License
98
+
99
+ This project is licensed under the [MIT License](./LICENSE.txt).
100
+
101
+ ### 👨‍💻 Our Contributors
102
+
103
+ <a href='https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors'>
104
+ <img src='https://contrib.rocks/image?repo=g1ampy/n2yo-api-wrapper'>
105
+ </a>
@@ -0,0 +1,10 @@
1
+ n2yo/__init__.py,sha256=N8d3NIbYiFzQ6DuhsHzEGvp-uJ4I7N0f0xwTeKgEmws,119
2
+ n2yo/exceptions.py,sha256=Z-H93Mp4KyQO15A68hpDeESBYBiMWM6hFfKBlULrJfM,146
3
+ n2yo/n2yo.py,sha256=HXNk19W9Z2-ZniaMBXcaLiX9yabzKtvp2y13Xo6qRxc,12242
4
+ n2yo/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ n2yo/models/search.py,sha256=2WMBbBlARzw-oqursCh1v0gmVgMvgne59OOzdg2cUlQ,4883
6
+ n2yo_api_wrapper-0.0.2.dist-info/LICENSE.txt,sha256=KrOVT7b9AFqez4zOs87D00B6dTAQCoeA_-4BXsJw5k0,1063
7
+ n2yo_api_wrapper-0.0.2.dist-info/METADATA,sha256=M5y69e3rW_mJxC-4zzDiFicNHNvstG0Q6WpnFV_16DA,3728
8
+ n2yo_api_wrapper-0.0.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
+ n2yo_api_wrapper-0.0.2.dist-info/top_level.txt,sha256=SzJLCYGYdl8bqgadcbj6EAqoadsVsYxc4UX0VEXWFGw,5
10
+ n2yo_api_wrapper-0.0.2.dist-info/RECORD,,
@@ -1,255 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: n2yo-api-wrapper
3
- Version: 0.0.1
4
- Summary: Unofficial Wrapper for N2YO.com API
5
- Home-page: https://github.com/g1ampy/n2yo-api-wrapper
6
- Author: Giampy
7
- Author-email: g1ampy@proton.me
8
- License: MIT
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Programming Language :: Python
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
- Requires-Python: >=3.10
15
- Description-Content-Type: text/markdown
16
- License-File: LICENSE.txt
17
- Requires-Dist: requests
18
- Requires-Dist: dacite
19
- Requires-Dist: beautifulsoup4
20
-
21
- <!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
22
- <a id="readme-top"></a>
23
- <!--
24
- *** Thanks for checking out the Best-README-Template. If you have a suggestion
25
- *** that would make this better, please fork the repo and create a pull request
26
- *** or simply open an issue with the tag "enhancement".
27
- *** Don't forget to give the project a star!
28
- *** Thanks again! Now go create something AMAZING! :D
29
- -->
30
-
31
-
32
-
33
- <!-- PROJECT SHIELDS -->
34
- <!--
35
- *** I'm using markdown "reference style" links for readability.
36
- *** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
37
- *** See the bottom of this document for the declaration of the reference variables
38
- *** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
39
- *** https://www.markdownguide.org/basic-syntax/#reference-style-links
40
- -->
41
- [![Forks][forks-shield]][forks-url]
42
- [![Stargazers][stars-shield]][stars-url]
43
- [![Contributors][contributors-shield]][contributors-url]
44
- [![Issues][issues-shield]][issues-url]
45
- [![PyPi][pypi-shield]][pypi-url]
46
- [![MIT][license-shield]][license-url]
47
-
48
-
49
- <!-- PROJECT LOGO -->
50
- <br />
51
- <div align="center">
52
- <a href="https://github.com/g1ampy/n2yo-api-wrapper">
53
- <img src="images/logo.png" alt="Logo" width="400">
54
- </a>
55
-
56
- <h3 align="center">N2YO.com API Wrapper</h3>
57
-
58
- <p align="center">
59
- A lightweight and easy-to-use Python wrapper for the N2YO.com API
60
- <br />
61
- <a href="https://github.com/g1ampy/n2yo-api-wrapper"><strong>« Explore the docs »</strong></a>
62
- <br />
63
- <br />
64
- <a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=bug&template=bug-report---.yml">Report Bug</a>
65
- &middot;
66
- <a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=enhancement&template=feature-request---.yml">Request Feature</a>
67
- </p>
68
- </div>
69
-
70
-
71
-
72
- <!-- TABLE OF CONTENTS -->
73
- <details>
74
- <summary>Table of Contents</summary>
75
- <ol>
76
- <li>
77
- <a href="#about-the-project">About The Project</a>
78
- <ul>
79
- <li><a href="#built-with">Built With</a></li>
80
- </ul>
81
- </li>
82
- <li>
83
- <a href="#getting-started">Getting Started</a>
84
- <ul>
85
- <li><a href="#prerequisites">Prerequisites</a></li>
86
- <li><a href="#installation">Installation</a></li>
87
- </ul>
88
- </li>
89
- <li><a href="#usage">Usage</a></li>
90
- <li><a href="#contributing">Contributing</a></li>
91
- <li><a href="#license">License</a></li>
92
- <li><a href="#contact">Contact</a></li>
93
- </ol>
94
- </details>
95
-
96
-
97
-
98
- <!-- ABOUT THE PROJECT -->
99
- ## ℹ️ About The Project
100
-
101
- The N2YO API Wrapper is a Python tool designed to interact with the N2YO satellite tracking API. It simplifies API requests, handles API keys and parses JSON responses into structured Python objects, providing methods to fetch real-time satellite positions, visible passes and orbital data. This makes it easy for developers to quickly and efficiently integrate satellite tracking and space data into their applications.
102
-
103
- <p align="right">(<a href="#readme-top">back to top</a>)</p>
104
-
105
-
106
-
107
- ### Built With
108
-
109
- [![Python][Python]][Python-url]
110
- [![requests][requests]][requests-url]
111
- [![dacite][dacite]][dacite-url]
112
-
113
- <p align="right">(<a href="#readme-top">back to top</a>)</p>
114
-
115
-
116
-
117
- <!-- GETTING STARTED -->
118
- ## 🟢 Getting Started
119
-
120
- To use the N2YO.com API Wrapper you can clone the repository or use `pip` package (recommended)
121
-
122
- ### Prerequisites
123
-
124
- - Python 3.10 or higher
125
- - A free API key from [https://www.n2yo.com](https://www.n2yo.com)
126
-
127
- ### Installation
128
- ```sh
129
- pip install n2yo-api-wrapper
130
- ```
131
-
132
- <p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
133
-
134
-
135
-
136
- <!-- USAGE EXAMPLES -->
137
- ## ❓ Usage
138
-
139
- Here’s a basic example of how to use the N2YO API wrapper to track a satellite (e.g., the ISS):
140
-
141
- ```python
142
- from n2yo import n2yo
143
-
144
- # Initialize the API client with your key
145
- wrapper = n2yo(api_key="YOUR_API_KEY")
146
-
147
- # Get real-time position of the ISS (satellite ID: 25544)
148
- position = wrapper.get_satellite_positions(
149
- id=25544,
150
- observer_lat=41.9028, # Latitude (e.g., Rome)
151
- observer_lng=12.4964, # Longitude
152
- observer_alt=100, # Altitude in meters
153
- seconds=1
154
- )
155
-
156
- print(position)
157
- ```
158
-
159
- ### 📌 Available Methods
160
-
161
- - `get_satellite_positions(...)` – Get current position of a satellite
162
- - `get_tle(satellite_id)` – Retrieve the TLE data
163
- - `get_visual_passes(...)` – Get upcoming visible passes
164
- - `get_radio_passes(...)` – Get upcoming radio passes
165
- - `get_above(...)` – List satellites currently above a location
166
-
167
- _For more examples, please refer to the [Documentation](https://www.n2yo.com/api/)_
168
-
169
- <p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
170
-
171
-
172
-
173
- <!-- CONTRIBUTING -->
174
- ## 🌱 Contributing
175
-
176
- Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
177
-
178
- If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
179
- Don't forget to give the project a star! Thanks again!
180
-
181
- 1. Fork the Project
182
- 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
183
- 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
184
- 4. Push to the Branch (`git push origin feature/AmazingFeature`)
185
- 5. Open a Pull Request
186
-
187
- <p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
188
-
189
-
190
-
191
- ### Top contributors:
192
-
193
- <a href="https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors">
194
- <img src="https://contrib.rocks/image?repo=g1ampy/n2yo-api-wrapper" alt="contrib.rocks image" />
195
- </a>
196
-
197
-
198
-
199
- <!-- LICENSE -->
200
- ## 📜 License
201
-
202
- Distributed under the MIT. See `LICENSE.txt` for more information.
203
-
204
- <p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
205
-
206
-
207
-
208
- <!-- CONTACT -->
209
- ## 📥 Contact
210
-
211
- <a href="mailto:g1ampy@proton.me">
212
- <img src="https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white" alt="Gmail">
213
- </a>
214
-
215
- <p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
216
-
217
-
218
-
219
- <!-- MARKDOWN LINKS & IMAGES -->
220
- <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
221
- [contributors-shield]: https://img.shields.io/github/contributors/g1ampy/n2yo-api-wrapper.svg
222
- [contributors-url]: https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors
223
- [forks-shield]: https://img.shields.io/github/forks/g1ampy/n2yo-api-wrapper.svg
224
- [forks-url]: https://github.com/g1ampy/n2yo-api-wrapper/network/members
225
- [stars-shield]: https://img.shields.io/github/stars/g1ampy/n2yo-api-wrapper.svg
226
- [stars-url]: https://github.com/g1ampy/n2yo-api-wrapper/stargazers
227
- [issues-shield]: https://img.shields.io/github/issues/g1ampy/n2yo-api-wrapper.svg
228
- [issues-url]: https://github.com/g1ampy/n2yo-api-wrapper/issues
229
- [pypi-shield]: https://img.shields.io/pypi/v/n2yo-api-wrapper
230
- [pypi-url]: https://pypi.org/project/n2yo-api-wrapper/
231
- [license-shield]: https://img.shields.io/github/license/g1ampy/n2yo-api-wrapper.svg
232
- [license-url]: https://github.com/g1ampy/n2yo-api-wrapper/blob/stable/LICENSE.txt
233
- [product-screenshot]: images/screenshot.png
234
- [Next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
235
- [Next-url]: https://nextjs.org/
236
- [React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
237
- [React-url]: https://reactjs.org/
238
- [Vue.js]: https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D
239
- [Vue-url]: https://vuejs.org/
240
- [Angular.io]: https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white
241
- [Angular-url]: https://angular.io/
242
- [Svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=for-the-badge&logo=svelte&logoColor=FF3E00
243
- [Svelte-url]: https://svelte.dev/
244
- [Laravel.com]: https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white
245
- [Laravel-url]: https://laravel.com
246
- [Bootstrap.com]: https://img.shields.io/badge/Bootstrap-563D7C?style=for-the-badge&logo=bootstrap&logoColor=white
247
- [Bootstrap-url]: https://getbootstrap.com
248
- [JQuery.com]: https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white
249
- [JQuery-url]: https://jquery.com
250
- [Python]: https://img.shields.io/badge/python-000000?style=for-the-badge&logo=python&logoColor=white
251
- [Python-url]: https://python.org/
252
- [dacite]: https://img.shields.io/badge/dacite-20232A?style=for-the-badge&logo=github&logoColor=61DAFB
253
- [dacite-url]: https://github.com/konradhalas/dacite
254
- [requests]: https://img.shields.io/badge/requests-35495E?style=for-the-badge&logo=github&logoColor=4FC08D
255
- [requests-url]: https://github.com/psf/requests
@@ -1,10 +0,0 @@
1
- n2yo/__init__.py,sha256=uZp9NRDAZK9M8vmAV-nz1_rD10Iis7jdRweNKM6P1xQ,119
2
- n2yo/exceptions.py,sha256=W61iNM2utXJ3twxlqlGF8insKISsoKd-J3jvLMzL6uA,40
3
- n2yo/n2yo.py,sha256=JZjoawa_NGxI9OAxUVXr7NcwwzK9cmsi22NWGa188S4,12182
4
- n2yo/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- n2yo/models/search.py,sha256=2WMBbBlARzw-oqursCh1v0gmVgMvgne59OOzdg2cUlQ,4883
6
- n2yo_api_wrapper-0.0.1.dist-info/LICENSE.txt,sha256=KrOVT7b9AFqez4zOs87D00B6dTAQCoeA_-4BXsJw5k0,1063
7
- n2yo_api_wrapper-0.0.1.dist-info/METADATA,sha256=0k2tUZQkEiuLW4u6biE7_BlIGiA3ekp45NJjU9jzjlQ,9332
8
- n2yo_api_wrapper-0.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
- n2yo_api_wrapper-0.0.1.dist-info/top_level.txt,sha256=SzJLCYGYdl8bqgadcbj6EAqoadsVsYxc4UX0VEXWFGw,5
10
- n2yo_api_wrapper-0.0.1.dist-info/RECORD,,