n2yo-api-wrapper 0.0.1__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.
- n2yo-api-wrapper-0.0.1/LICENSE.txt +21 -0
- n2yo-api-wrapper-0.0.1/PKG-INFO +252 -0
- n2yo-api-wrapper-0.0.1/README.md +235 -0
- n2yo-api-wrapper-0.0.1/n2yo/__init__.py +6 -0
- n2yo-api-wrapper-0.0.1/n2yo/exceptions.py +2 -0
- n2yo-api-wrapper-0.0.1/n2yo/models/__init__.py +0 -0
- n2yo-api-wrapper-0.0.1/n2yo/models/search.py +87 -0
- n2yo-api-wrapper-0.0.1/n2yo/n2yo.py +264 -0
- n2yo-api-wrapper-0.0.1/n2yo_api_wrapper.egg-info/PKG-INFO +252 -0
- n2yo-api-wrapper-0.0.1/n2yo_api_wrapper.egg-info/SOURCES.txt +13 -0
- n2yo-api-wrapper-0.0.1/n2yo_api_wrapper.egg-info/dependency_links.txt +1 -0
- n2yo-api-wrapper-0.0.1/n2yo_api_wrapper.egg-info/requires.txt +3 -0
- n2yo-api-wrapper-0.0.1/n2yo_api_wrapper.egg-info/top_level.txt +1 -0
- n2yo-api-wrapper-0.0.1/setup.cfg +4 -0
- n2yo-api-wrapper-0.0.1/setup.py +26 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Giampy
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,252 @@
|
|
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
|
+
|
18
|
+
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
|
19
|
+
<a id="readme-top"></a>
|
20
|
+
<!--
|
21
|
+
*** Thanks for checking out the Best-README-Template. If you have a suggestion
|
22
|
+
*** that would make this better, please fork the repo and create a pull request
|
23
|
+
*** or simply open an issue with the tag "enhancement".
|
24
|
+
*** Don't forget to give the project a star!
|
25
|
+
*** Thanks again! Now go create something AMAZING! :D
|
26
|
+
-->
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
<!-- PROJECT SHIELDS -->
|
31
|
+
<!--
|
32
|
+
*** I'm using markdown "reference style" links for readability.
|
33
|
+
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
|
34
|
+
*** See the bottom of this document for the declaration of the reference variables
|
35
|
+
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
|
36
|
+
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
|
37
|
+
-->
|
38
|
+
[![Forks][forks-shield]][forks-url]
|
39
|
+
[![Stargazers][stars-shield]][stars-url]
|
40
|
+
[![Contributors][contributors-shield]][contributors-url]
|
41
|
+
[![Issues][issues-shield]][issues-url]
|
42
|
+
[![PyPi][pypi-shield]][pypi-url]
|
43
|
+
[![MIT][license-shield]][license-url]
|
44
|
+
|
45
|
+
|
46
|
+
<!-- PROJECT LOGO -->
|
47
|
+
<br />
|
48
|
+
<div align="center">
|
49
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper">
|
50
|
+
<img src="images/logo.png" alt="Logo" width="400">
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<h3 align="center">N2YO.com API Wrapper</h3>
|
54
|
+
|
55
|
+
<p align="center">
|
56
|
+
A lightweight and easy-to-use Python wrapper for the N2YO.com API
|
57
|
+
<br />
|
58
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper"><strong>« Explore the docs »</strong></a>
|
59
|
+
<br />
|
60
|
+
<br />
|
61
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=bug&template=bug-report---.yml">Report Bug</a>
|
62
|
+
·
|
63
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=enhancement&template=feature-request---.yml">Request Feature</a>
|
64
|
+
</p>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<!-- TABLE OF CONTENTS -->
|
70
|
+
<details>
|
71
|
+
<summary>Table of Contents</summary>
|
72
|
+
<ol>
|
73
|
+
<li>
|
74
|
+
<a href="#about-the-project">About The Project</a>
|
75
|
+
<ul>
|
76
|
+
<li><a href="#built-with">Built With</a></li>
|
77
|
+
</ul>
|
78
|
+
</li>
|
79
|
+
<li>
|
80
|
+
<a href="#getting-started">Getting Started</a>
|
81
|
+
<ul>
|
82
|
+
<li><a href="#prerequisites">Prerequisites</a></li>
|
83
|
+
<li><a href="#installation">Installation</a></li>
|
84
|
+
</ul>
|
85
|
+
</li>
|
86
|
+
<li><a href="#usage">Usage</a></li>
|
87
|
+
<li><a href="#contributing">Contributing</a></li>
|
88
|
+
<li><a href="#license">License</a></li>
|
89
|
+
<li><a href="#contact">Contact</a></li>
|
90
|
+
</ol>
|
91
|
+
</details>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<!-- ABOUT THE PROJECT -->
|
96
|
+
## ℹ️ About The Project
|
97
|
+
|
98
|
+
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.
|
99
|
+
|
100
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
### Built With
|
105
|
+
|
106
|
+
[![Python][Python]][Python-url]
|
107
|
+
[![requests][requests]][requests-url]
|
108
|
+
[![dacite][dacite]][dacite-url]
|
109
|
+
|
110
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- GETTING STARTED -->
|
115
|
+
## 🟢 Getting Started
|
116
|
+
|
117
|
+
To use the N2YO.com API Wrapper you can clone the repository or use `pip` package (recommended)
|
118
|
+
|
119
|
+
### Prerequisites
|
120
|
+
|
121
|
+
- Python 3.10 or higher
|
122
|
+
- A free API key from [https://www.n2yo.com](https://www.n2yo.com)
|
123
|
+
|
124
|
+
### Installation
|
125
|
+
```sh
|
126
|
+
pip install n2yo-api-wrapper
|
127
|
+
```
|
128
|
+
|
129
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- USAGE EXAMPLES -->
|
134
|
+
## ❓ Usage
|
135
|
+
|
136
|
+
Here’s a basic example of how to use the N2YO API wrapper to track a satellite (e.g., the ISS):
|
137
|
+
|
138
|
+
```python
|
139
|
+
from n2yo import n2yo
|
140
|
+
|
141
|
+
# Initialize the API client with your key
|
142
|
+
wrapper = n2yo(api_key="YOUR_API_KEY")
|
143
|
+
|
144
|
+
# Get real-time position of the ISS (satellite ID: 25544)
|
145
|
+
position = wrapper.get_satellite_positions(
|
146
|
+
id=25544,
|
147
|
+
observer_lat=41.9028, # Latitude (e.g., Rome)
|
148
|
+
observer_lng=12.4964, # Longitude
|
149
|
+
observer_alt=100, # Altitude in meters
|
150
|
+
seconds=1
|
151
|
+
)
|
152
|
+
|
153
|
+
print(position)
|
154
|
+
```
|
155
|
+
|
156
|
+
### 📌 Available Methods
|
157
|
+
|
158
|
+
- `get_satellite_positions(...)` – Get current position of a satellite
|
159
|
+
- `get_tle(satellite_id)` – Retrieve the TLE data
|
160
|
+
- `get_visual_passes(...)` – Get upcoming visible passes
|
161
|
+
- `get_radio_passes(...)` – Get upcoming radio passes
|
162
|
+
- `get_above(...)` – List satellites currently above a location
|
163
|
+
|
164
|
+
_For more examples, please refer to the [Documentation](https://www.n2yo.com/api/)_
|
165
|
+
|
166
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<!-- CONTRIBUTING -->
|
171
|
+
## 🌱 Contributing
|
172
|
+
|
173
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
174
|
+
|
175
|
+
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".
|
176
|
+
Don't forget to give the project a star! Thanks again!
|
177
|
+
|
178
|
+
1. Fork the Project
|
179
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
180
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
181
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
182
|
+
5. Open a Pull Request
|
183
|
+
|
184
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
### Top contributors:
|
189
|
+
|
190
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors">
|
191
|
+
<img src="https://contrib.rocks/image?repo=g1ampy/n2yo-api-wrapper" alt="contrib.rocks image" />
|
192
|
+
</a>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<!-- LICENSE -->
|
197
|
+
## 📜 License
|
198
|
+
|
199
|
+
Distributed under the MIT. See `LICENSE.txt` for more information.
|
200
|
+
|
201
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<!-- CONTACT -->
|
206
|
+
## 📥 Contact
|
207
|
+
|
208
|
+
<a href="mailto:g1ampy@proton.me">
|
209
|
+
<img src="https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white" alt="Gmail">
|
210
|
+
</a>
|
211
|
+
|
212
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
217
|
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
218
|
+
[contributors-shield]: https://img.shields.io/github/contributors/g1ampy/n2yo-api-wrapper.svg
|
219
|
+
[contributors-url]: https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors
|
220
|
+
[forks-shield]: https://img.shields.io/github/forks/g1ampy/n2yo-api-wrapper.svg
|
221
|
+
[forks-url]: https://github.com/g1ampy/n2yo-api-wrapper/network/members
|
222
|
+
[stars-shield]: https://img.shields.io/github/stars/g1ampy/n2yo-api-wrapper.svg
|
223
|
+
[stars-url]: https://github.com/g1ampy/n2yo-api-wrapper/stargazers
|
224
|
+
[issues-shield]: https://img.shields.io/github/issues/g1ampy/n2yo-api-wrapper.svg
|
225
|
+
[issues-url]: https://github.com/g1ampy/n2yo-api-wrapper/issues
|
226
|
+
[pypi-shield]: https://img.shields.io/pypi/v/n2yo-api-wrapper
|
227
|
+
[pypi-url]: https://pypi.org/project/n2yo-api-wrapper/
|
228
|
+
[license-shield]: https://img.shields.io/github/license/g1ampy/n2yo-api-wrapper.svg
|
229
|
+
[license-url]: https://github.com/g1ampy/n2yo-api-wrapper/blob/stable/LICENSE.txt
|
230
|
+
[product-screenshot]: images/screenshot.png
|
231
|
+
[Next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
|
232
|
+
[Next-url]: https://nextjs.org/
|
233
|
+
[React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
|
234
|
+
[React-url]: https://reactjs.org/
|
235
|
+
[Vue.js]: https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D
|
236
|
+
[Vue-url]: https://vuejs.org/
|
237
|
+
[Angular.io]: https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white
|
238
|
+
[Angular-url]: https://angular.io/
|
239
|
+
[Svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=for-the-badge&logo=svelte&logoColor=FF3E00
|
240
|
+
[Svelte-url]: https://svelte.dev/
|
241
|
+
[Laravel.com]: https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white
|
242
|
+
[Laravel-url]: https://laravel.com
|
243
|
+
[Bootstrap.com]: https://img.shields.io/badge/Bootstrap-563D7C?style=for-the-badge&logo=bootstrap&logoColor=white
|
244
|
+
[Bootstrap-url]: https://getbootstrap.com
|
245
|
+
[JQuery.com]: https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white
|
246
|
+
[JQuery-url]: https://jquery.com
|
247
|
+
[Python]: https://img.shields.io/badge/python-000000?style=for-the-badge&logo=python&logoColor=white
|
248
|
+
[Python-url]: https://python.org/
|
249
|
+
[dacite]: https://img.shields.io/badge/dacite-20232A?style=for-the-badge&logo=github&logoColor=61DAFB
|
250
|
+
[dacite-url]: https://github.com/konradhalas/dacite
|
251
|
+
[requests]: https://img.shields.io/badge/requests-35495E?style=for-the-badge&logo=github&logoColor=4FC08D
|
252
|
+
[requests-url]: https://github.com/psf/requests
|
@@ -0,0 +1,235 @@
|
|
1
|
+
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
|
2
|
+
<a id="readme-top"></a>
|
3
|
+
<!--
|
4
|
+
*** Thanks for checking out the Best-README-Template. If you have a suggestion
|
5
|
+
*** that would make this better, please fork the repo and create a pull request
|
6
|
+
*** or simply open an issue with the tag "enhancement".
|
7
|
+
*** Don't forget to give the project a star!
|
8
|
+
*** Thanks again! Now go create something AMAZING! :D
|
9
|
+
-->
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<!-- PROJECT SHIELDS -->
|
14
|
+
<!--
|
15
|
+
*** I'm using markdown "reference style" links for readability.
|
16
|
+
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
|
17
|
+
*** See the bottom of this document for the declaration of the reference variables
|
18
|
+
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
|
19
|
+
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
|
20
|
+
-->
|
21
|
+
[![Forks][forks-shield]][forks-url]
|
22
|
+
[![Stargazers][stars-shield]][stars-url]
|
23
|
+
[![Contributors][contributors-shield]][contributors-url]
|
24
|
+
[![Issues][issues-shield]][issues-url]
|
25
|
+
[![PyPi][pypi-shield]][pypi-url]
|
26
|
+
[![MIT][license-shield]][license-url]
|
27
|
+
|
28
|
+
|
29
|
+
<!-- PROJECT LOGO -->
|
30
|
+
<br />
|
31
|
+
<div align="center">
|
32
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper">
|
33
|
+
<img src="images/logo.png" alt="Logo" width="400">
|
34
|
+
</a>
|
35
|
+
|
36
|
+
<h3 align="center">N2YO.com API Wrapper</h3>
|
37
|
+
|
38
|
+
<p align="center">
|
39
|
+
A lightweight and easy-to-use Python wrapper for the N2YO.com API
|
40
|
+
<br />
|
41
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper"><strong>« Explore the docs »</strong></a>
|
42
|
+
<br />
|
43
|
+
<br />
|
44
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=bug&template=bug-report---.yml">Report Bug</a>
|
45
|
+
·
|
46
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=enhancement&template=feature-request---.yml">Request Feature</a>
|
47
|
+
</p>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
<!-- TABLE OF CONTENTS -->
|
53
|
+
<details>
|
54
|
+
<summary>Table of Contents</summary>
|
55
|
+
<ol>
|
56
|
+
<li>
|
57
|
+
<a href="#about-the-project">About The Project</a>
|
58
|
+
<ul>
|
59
|
+
<li><a href="#built-with">Built With</a></li>
|
60
|
+
</ul>
|
61
|
+
</li>
|
62
|
+
<li>
|
63
|
+
<a href="#getting-started">Getting Started</a>
|
64
|
+
<ul>
|
65
|
+
<li><a href="#prerequisites">Prerequisites</a></li>
|
66
|
+
<li><a href="#installation">Installation</a></li>
|
67
|
+
</ul>
|
68
|
+
</li>
|
69
|
+
<li><a href="#usage">Usage</a></li>
|
70
|
+
<li><a href="#contributing">Contributing</a></li>
|
71
|
+
<li><a href="#license">License</a></li>
|
72
|
+
<li><a href="#contact">Contact</a></li>
|
73
|
+
</ol>
|
74
|
+
</details>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<!-- ABOUT THE PROJECT -->
|
79
|
+
## ℹ️ About The Project
|
80
|
+
|
81
|
+
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.
|
82
|
+
|
83
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
### Built With
|
88
|
+
|
89
|
+
[![Python][Python]][Python-url]
|
90
|
+
[![requests][requests]][requests-url]
|
91
|
+
[![dacite][dacite]][dacite-url]
|
92
|
+
|
93
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<!-- GETTING STARTED -->
|
98
|
+
## 🟢 Getting Started
|
99
|
+
|
100
|
+
To use the N2YO.com API Wrapper you can clone the repository or use `pip` package (recommended)
|
101
|
+
|
102
|
+
### Prerequisites
|
103
|
+
|
104
|
+
- Python 3.10 or higher
|
105
|
+
- A free API key from [https://www.n2yo.com](https://www.n2yo.com)
|
106
|
+
|
107
|
+
### Installation
|
108
|
+
```sh
|
109
|
+
pip install n2yo-api-wrapper
|
110
|
+
```
|
111
|
+
|
112
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<!-- USAGE EXAMPLES -->
|
117
|
+
## ❓ Usage
|
118
|
+
|
119
|
+
Here’s a basic example of how to use the N2YO API wrapper to track a satellite (e.g., the ISS):
|
120
|
+
|
121
|
+
```python
|
122
|
+
from n2yo import n2yo
|
123
|
+
|
124
|
+
# Initialize the API client with your key
|
125
|
+
wrapper = n2yo(api_key="YOUR_API_KEY")
|
126
|
+
|
127
|
+
# Get real-time position of the ISS (satellite ID: 25544)
|
128
|
+
position = wrapper.get_satellite_positions(
|
129
|
+
id=25544,
|
130
|
+
observer_lat=41.9028, # Latitude (e.g., Rome)
|
131
|
+
observer_lng=12.4964, # Longitude
|
132
|
+
observer_alt=100, # Altitude in meters
|
133
|
+
seconds=1
|
134
|
+
)
|
135
|
+
|
136
|
+
print(position)
|
137
|
+
```
|
138
|
+
|
139
|
+
### 📌 Available Methods
|
140
|
+
|
141
|
+
- `get_satellite_positions(...)` – Get current position of a satellite
|
142
|
+
- `get_tle(satellite_id)` – Retrieve the TLE data
|
143
|
+
- `get_visual_passes(...)` – Get upcoming visible passes
|
144
|
+
- `get_radio_passes(...)` – Get upcoming radio passes
|
145
|
+
- `get_above(...)` – List satellites currently above a location
|
146
|
+
|
147
|
+
_For more examples, please refer to the [Documentation](https://www.n2yo.com/api/)_
|
148
|
+
|
149
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<!-- CONTRIBUTING -->
|
154
|
+
## 🌱 Contributing
|
155
|
+
|
156
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
157
|
+
|
158
|
+
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".
|
159
|
+
Don't forget to give the project a star! Thanks again!
|
160
|
+
|
161
|
+
1. Fork the Project
|
162
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
163
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
164
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
165
|
+
5. Open a Pull Request
|
166
|
+
|
167
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
### Top contributors:
|
172
|
+
|
173
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors">
|
174
|
+
<img src="https://contrib.rocks/image?repo=g1ampy/n2yo-api-wrapper" alt="contrib.rocks image" />
|
175
|
+
</a>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<!-- LICENSE -->
|
180
|
+
## 📜 License
|
181
|
+
|
182
|
+
Distributed under the MIT. See `LICENSE.txt` for more information.
|
183
|
+
|
184
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<!-- CONTACT -->
|
189
|
+
## 📥 Contact
|
190
|
+
|
191
|
+
<a href="mailto:g1ampy@proton.me">
|
192
|
+
<img src="https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white" alt="Gmail">
|
193
|
+
</a>
|
194
|
+
|
195
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
200
|
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
201
|
+
[contributors-shield]: https://img.shields.io/github/contributors/g1ampy/n2yo-api-wrapper.svg
|
202
|
+
[contributors-url]: https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors
|
203
|
+
[forks-shield]: https://img.shields.io/github/forks/g1ampy/n2yo-api-wrapper.svg
|
204
|
+
[forks-url]: https://github.com/g1ampy/n2yo-api-wrapper/network/members
|
205
|
+
[stars-shield]: https://img.shields.io/github/stars/g1ampy/n2yo-api-wrapper.svg
|
206
|
+
[stars-url]: https://github.com/g1ampy/n2yo-api-wrapper/stargazers
|
207
|
+
[issues-shield]: https://img.shields.io/github/issues/g1ampy/n2yo-api-wrapper.svg
|
208
|
+
[issues-url]: https://github.com/g1ampy/n2yo-api-wrapper/issues
|
209
|
+
[pypi-shield]: https://img.shields.io/pypi/v/n2yo-api-wrapper
|
210
|
+
[pypi-url]: https://pypi.org/project/n2yo-api-wrapper/
|
211
|
+
[license-shield]: https://img.shields.io/github/license/g1ampy/n2yo-api-wrapper.svg
|
212
|
+
[license-url]: https://github.com/g1ampy/n2yo-api-wrapper/blob/stable/LICENSE.txt
|
213
|
+
[product-screenshot]: images/screenshot.png
|
214
|
+
[Next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
|
215
|
+
[Next-url]: https://nextjs.org/
|
216
|
+
[React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
|
217
|
+
[React-url]: https://reactjs.org/
|
218
|
+
[Vue.js]: https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D
|
219
|
+
[Vue-url]: https://vuejs.org/
|
220
|
+
[Angular.io]: https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white
|
221
|
+
[Angular-url]: https://angular.io/
|
222
|
+
[Svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=for-the-badge&logo=svelte&logoColor=FF3E00
|
223
|
+
[Svelte-url]: https://svelte.dev/
|
224
|
+
[Laravel.com]: https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white
|
225
|
+
[Laravel-url]: https://laravel.com
|
226
|
+
[Bootstrap.com]: https://img.shields.io/badge/Bootstrap-563D7C?style=for-the-badge&logo=bootstrap&logoColor=white
|
227
|
+
[Bootstrap-url]: https://getbootstrap.com
|
228
|
+
[JQuery.com]: https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white
|
229
|
+
[JQuery-url]: https://jquery.com
|
230
|
+
[Python]: https://img.shields.io/badge/python-000000?style=for-the-badge&logo=python&logoColor=white
|
231
|
+
[Python-url]: https://python.org/
|
232
|
+
[dacite]: https://img.shields.io/badge/dacite-20232A?style=for-the-badge&logo=github&logoColor=61DAFB
|
233
|
+
[dacite-url]: https://github.com/konradhalas/dacite
|
234
|
+
[requests]: https://img.shields.io/badge/requests-35495E?style=for-the-badge&logo=github&logoColor=4FC08D
|
235
|
+
[requests-url]: https://github.com/psf/requests
|
File without changes
|
@@ -0,0 +1,87 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import List, Optional
|
3
|
+
|
4
|
+
|
5
|
+
@dataclass
|
6
|
+
class SatelliteInfo:
|
7
|
+
category: Optional[str] # Category name (ANY if category id requested was 0)
|
8
|
+
satid: Optional[int] # NORAD id used in input
|
9
|
+
satcount : Optional[int] # Count of satellites returned
|
10
|
+
satname: Optional[str] # Satellite name
|
11
|
+
transactionscount: int # Count of transactions performed with this API key in last 60 minutes
|
12
|
+
passescount: Optional[int] # Count of passes returned
|
13
|
+
|
14
|
+
@dataclass
|
15
|
+
class SatellitePosition:
|
16
|
+
satlatitude: float # Satellite footprint latitude (decimal degrees format)
|
17
|
+
satlongitude: float # Satellite footprint longitude (decimal degrees format)
|
18
|
+
azimuth: float # Satellite azimuth with respect to observer's location (degrees)
|
19
|
+
elevation: float # Satellite elevation with respect to observer's location (degrees)
|
20
|
+
ra: float # Satellite right ascension (degrees)
|
21
|
+
dec: float # Satellite declination (degrees)
|
22
|
+
timestamp: int # Unix time for this position (seconds). You should convert this UTC value to observer's time zone
|
23
|
+
|
24
|
+
@dataclass
|
25
|
+
class VisualPass:
|
26
|
+
startAz: float # Satellite azimuth for the start of this pass (relative to the observer, in degrees)
|
27
|
+
startAzCompass: str # Satellite azimuth for the start of this pass (relative to the observer). Possible values: N, NE, E, SE, S, SW, W, NW
|
28
|
+
startEl: float # Satellite elevation for the start of this pass (relative to the observer, in degrees)
|
29
|
+
startUTC: int # Unix time for the start of this pass. You should convert this UTC value to observer's time zone
|
30
|
+
maxAz: float # Satellite azimuth for the max elevation of this pass (relative to the observer, in degrees)
|
31
|
+
maxAzCompass: str # Satellite azimuth for the max elevation of this pass (relative to the observer). Possible values: N, NE, E, SE, S, SW, W, NW
|
32
|
+
maxEl: float # Satellite max elevation for this pass (relative to the observer, in degrees)
|
33
|
+
maxUTC: int # Unix time for the max elevation of this pass. You should convert this UTC value to observer's time zone
|
34
|
+
endAz: float # Satellite azimuth for the end of this pass (relative to the observer, in degrees)
|
35
|
+
endAzCompass: str # Satellite azimuth for the end of this pass (relative to the observer). Possible values: N, NE, E, SE, S, SW, W, NW
|
36
|
+
endEl: float #Satellite elevation for the end of this pass (relative to the observer, in degrees)
|
37
|
+
endUTC: int # Unix time for the end of this pass. You should convert this UTC value to observer's time zone
|
38
|
+
mag: float # Max visual magnitude of the pass, same scale as star brightness. If magnitude cannot be determined, the value is 100000
|
39
|
+
duration: int # Total visible duration of this pass (in seconds)
|
40
|
+
|
41
|
+
@dataclass
|
42
|
+
class RadioPass:
|
43
|
+
startAz: float # Satellite azimuth for the start of this pass (relative to the observer, in degrees)
|
44
|
+
startAzCompass: str # Satellite azimuth for the start of this pass (relative to the observer). Possible values: N, NE, E, SE, S, SW, W, NW
|
45
|
+
startUTC: int # Unix time for the start of this pass. You should convert this UTC value to observer's time zone
|
46
|
+
maxAz: float # Satellite azimuth for the max elevation of this pass (relative to the observer, in degrees)
|
47
|
+
maxAzCompass: str # Satellite azimuth for the max elevation of this pass (relative to the observer). Possible values: N, NE, E, SE, S, SW, W, NW
|
48
|
+
maxEl: float # Satellite max elevation for this pass (relative to the observer, in degrees)
|
49
|
+
maxUTC: int # Unix time for the max elevation of this pass. You should convert this UTC value to observer's time zone
|
50
|
+
endAz: float # Satellite azimuth for the end of this pass (relative to the observer, in degrees)
|
51
|
+
endAzCompass: str # Satellite azimuth for the end of this pass (relative to the observer). Possible values: N, NE, E, SE, S, SW, W, NW
|
52
|
+
endUTC: int # Unix time for the end of this pass. You should convert this UTC value to observer's time zone
|
53
|
+
|
54
|
+
@dataclass
|
55
|
+
class SatelliteAbove:
|
56
|
+
satid: int # Satellite NORAD id
|
57
|
+
intDesignator: str # Satellite international designator
|
58
|
+
satname: str # Satellite name
|
59
|
+
launchDate: str # Satellite launch date (YYYY-MM-DD)
|
60
|
+
satlat: float # Satellite footprint latitude (decimal degrees format)
|
61
|
+
satlng: float # Satellite footprint longitude (decimal degrees format)
|
62
|
+
satalt: float # Satellite altitude (km)
|
63
|
+
|
64
|
+
@dataclass
|
65
|
+
class TleData:
|
66
|
+
info: SatelliteInfo
|
67
|
+
tle: str # TLE on single line string. Split the line in two by \r\n to get original two lines
|
68
|
+
|
69
|
+
@dataclass
|
70
|
+
class SatellitePositionsData:
|
71
|
+
info: SatelliteInfo
|
72
|
+
positions: List[SatellitePosition]
|
73
|
+
|
74
|
+
@dataclass
|
75
|
+
class VisualPassesData:
|
76
|
+
info: SatelliteInfo
|
77
|
+
passes: List[VisualPass]
|
78
|
+
|
79
|
+
@dataclass
|
80
|
+
class RadioPassesData:
|
81
|
+
info: SatelliteInfo
|
82
|
+
passes: List[RadioPass]
|
83
|
+
|
84
|
+
@dataclass
|
85
|
+
class SatellitesAboveData:
|
86
|
+
info: SatelliteInfo
|
87
|
+
above: List[SatelliteAbove]
|
@@ -0,0 +1,264 @@
|
|
1
|
+
import logging, requests
|
2
|
+
from dacite import from_dict
|
3
|
+
|
4
|
+
from .models.search import TleData, SatellitePositionsData, VisualPassesData, RadioPassesData, SatellitesAboveData
|
5
|
+
from .exceptions import InvalidApiKey
|
6
|
+
|
7
|
+
|
8
|
+
# Set up logging - datetime format, level, and format
|
9
|
+
# Default to INFO level
|
10
|
+
|
11
|
+
logging.basicConfig(
|
12
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
13
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
14
|
+
level=logging.INFO,
|
15
|
+
)
|
16
|
+
|
17
|
+
logger = logging.getLogger(__name__)
|
18
|
+
|
19
|
+
|
20
|
+
class n2yo:
|
21
|
+
def __init__(self, api_key: str)-> None:
|
22
|
+
|
23
|
+
self.apiKey = api_key
|
24
|
+
self.params = {'apiKey': self.apiKey}
|
25
|
+
|
26
|
+
self.base_url = f"https://api.n2yo.com"
|
27
|
+
self.api_url = f"{self.base_url}/rest/v1/satellite/"
|
28
|
+
|
29
|
+
logger.info("n2yo client initialization completed successfully")
|
30
|
+
|
31
|
+
def get_tle(self,
|
32
|
+
id: int) -> TleData:
|
33
|
+
|
34
|
+
"""
|
35
|
+
Retrieve the Two Line Elements (TLE) for a satellite identified by NORAD id.
|
36
|
+
|
37
|
+
|
38
|
+
**API Endpoint**
|
39
|
+
`/tle/{id}`
|
40
|
+
|
41
|
+
**Parameters:**
|
42
|
+
`id` (int): NORAD satellite ID (**required**)
|
43
|
+
|
44
|
+
**Returns:**
|
45
|
+
TleData: A structured object containing satellite data.
|
46
|
+
|
47
|
+
**Response Fields:**
|
48
|
+
`satid` (int): NORAD ID used in the request
|
49
|
+
`satname` (str): Satellite name
|
50
|
+
`transactionscount` (int): API transaction count in the past 60 minutes
|
51
|
+
`tle` (str): Full Two Line Element set for the satellite
|
52
|
+
"""
|
53
|
+
|
54
|
+
response = requests.get(url=f'{self.api_url}tle/{id}/', params=self.params)
|
55
|
+
data = response.json()
|
56
|
+
|
57
|
+
if data.get("error") == "Invalid API Key!":
|
58
|
+
raise InvalidApiKey("The API key is invalid or missing.")
|
59
|
+
|
60
|
+
result = from_dict(data_class=TleData, data=data)
|
61
|
+
return result
|
62
|
+
|
63
|
+
def get_satellite_positions(self,
|
64
|
+
id: int,
|
65
|
+
observer_lat: float,
|
66
|
+
observer_lng: float,
|
67
|
+
observer_alt: float,
|
68
|
+
seconds: float) -> SatellitePositionsData:
|
69
|
+
|
70
|
+
"""
|
71
|
+
Retrieve the future positions of any satellite as footprints (latitude, longitude) to display orbits on maps. Also return the satellite's azimuth and elevation with respect to the observer location. Each element in the response array is one second of calculation. First element is calculated for current UTC time.
|
72
|
+
|
73
|
+
|
74
|
+
**API Endpoint**
|
75
|
+
`/positions/{id}/{observer_lat}/{observer_lng}/{observer_alt}/{seconds}`
|
76
|
+
|
77
|
+
**Parameters:**
|
78
|
+
`id` (int): NORAD satellite ID
|
79
|
+
`observer_lat` (float): Observer's latitude (decimal degrees)
|
80
|
+
`observer_lng` (float): Observer's longitude (decimal degrees)
|
81
|
+
`observer_alt` (float): Altitude above sea level (meters)
|
82
|
+
`seconds` (int): Number of future seconds to calculate (max 300)
|
83
|
+
|
84
|
+
**Returns:**
|
85
|
+
SatellitePositionsData: A structured object containing satellite positions data.
|
86
|
+
|
87
|
+
**Response Fields:**
|
88
|
+
`satid` (int): NORAD ID used in request
|
89
|
+
`satname` (str): Satellite name
|
90
|
+
`transactionscount` (int): API usage in the past 60 minutes
|
91
|
+
`satlatitude` (float): Satellite latitude projection on Earth's surface
|
92
|
+
`satlongitude` (float): Satellite longitude projection on Earth's surface
|
93
|
+
`azimuth` (float): Azimuth angle from observer to satellite (degrees)
|
94
|
+
`elevation` (float): Elevation angle from observer to satellite (degrees)
|
95
|
+
`ra` (float): Right ascension in celestial coordinates (degrees)
|
96
|
+
`dec` (float): Declination in celestial coordinates (degrees)
|
97
|
+
`timestamp` (int): UNIX timestamp for this position (UTC)
|
98
|
+
"""
|
99
|
+
|
100
|
+
response = requests.get(url=f'{self.api_url}positions/{id}/{observer_lat}/{observer_lng}/{observer_alt}/{seconds}/', params=self.params)
|
101
|
+
data = response.json()
|
102
|
+
|
103
|
+
if data.get("error") == "Invalid API Key!":
|
104
|
+
raise InvalidApiKey("The API key is invalid or missing.")
|
105
|
+
|
106
|
+
result = from_dict(data_class=SatellitePositionsData, data=data)
|
107
|
+
return result
|
108
|
+
|
109
|
+
def get_visual_passes(self,
|
110
|
+
id: int,
|
111
|
+
observer_lat: float,
|
112
|
+
observer_lng: float,
|
113
|
+
observer_alt: float,
|
114
|
+
days: int,
|
115
|
+
min_visibility: int) -> VisualPassesData:
|
116
|
+
|
117
|
+
"""
|
118
|
+
Get predicted visual passes for any satellite relative to a location on Earth. A 'visual pass' is a pass that should be optically visible on the entire (or partial) duration of crossing the sky. For that to happen, the satellite must be above the horizon, illumintaed by Sun (not in Earth shadow), and the sky dark enough to allow visual satellite observation.
|
119
|
+
|
120
|
+
|
121
|
+
**API Endpoint**
|
122
|
+
`/visualpasses/{id}/{observer_lat}/{observer_lng}/{observer_alt}/{days}/{min_visibility}`
|
123
|
+
|
124
|
+
**Parameters:**
|
125
|
+
`id` (int): NORAD satellite ID
|
126
|
+
`observer_lat` (float): Observer's latitude (decimal degrees)
|
127
|
+
`observer_lng` (float): Observer's longitude (decimal degrees)
|
128
|
+
`observer_alt` (float): Observer's altitude (meters)
|
129
|
+
`days` (int): Number of days to search (max 10)
|
130
|
+
`min_visibility` (int): Minimum number of seconds satellite must be visible to include the pass
|
131
|
+
|
132
|
+
**Returns:**
|
133
|
+
VisualPassesData: A structured object containing visual passes data.
|
134
|
+
|
135
|
+
**Response Fields:**
|
136
|
+
`satid` (int): Same NORAD ID provided in input
|
137
|
+
`satname` (str): Name of the satellite
|
138
|
+
`transactionscount` (int): Number of API calls in the last 60 minutes
|
139
|
+
`passescount` (int): Number of passes returned
|
140
|
+
`startAz` (float): Azimuth at start of pass (degrees)
|
141
|
+
`startAzCompass` (str): Cardinal direction of start azimuth (e.g., N, NE, E, SE, ...)
|
142
|
+
`startEl` (float): Elevation at start of pass (degrees)
|
143
|
+
`startUTC` (int): UNIX timestamp for start of pass (UTC)
|
144
|
+
`maxAz` (float): Azimuth at max elevation point
|
145
|
+
`maxAzCompass` (str): Cardinal direction of max azimuth
|
146
|
+
`maxEl` (float): Maximum elevation during pass (degrees)
|
147
|
+
`maxUTC` (int): UNIX timestamp for max elevation point (UTC)
|
148
|
+
`endAz` (float): Azimuth at end of pass
|
149
|
+
`endAzCompass` (str): Cardinal direction of end azimuth
|
150
|
+
`endEl` (float): Elevation at end of pass (degrees)
|
151
|
+
`endUTC` (int): UNIX timestamp for end of pass (UTC)
|
152
|
+
`mag` (float): Maximum visual magnitude (smaller = brighter; 100000 = unknown)
|
153
|
+
`duration` (int): Total visible duration of the pass (in seconds)
|
154
|
+
"""
|
155
|
+
|
156
|
+
response = requests.get(url=f'{self.api_url}visualpasses/{id}/{observer_lat}/{observer_lng}/{observer_alt}/{days}/{min_visibility}/', params=self.params)
|
157
|
+
data = response.json()
|
158
|
+
|
159
|
+
if data.get("error") == "Invalid API Key!":
|
160
|
+
raise InvalidApiKey("The API key is invalid or missing.")
|
161
|
+
|
162
|
+
result = from_dict(data_class=VisualPassesData, data=data)
|
163
|
+
return result
|
164
|
+
|
165
|
+
def get_radio_passes(self,
|
166
|
+
id: int,
|
167
|
+
observer_lat: float,
|
168
|
+
observer_lng: float,
|
169
|
+
observer_alt: float,
|
170
|
+
days: int,
|
171
|
+
min_elevation: int) -> RadioPassesData:
|
172
|
+
|
173
|
+
"""
|
174
|
+
The 'radio passes' are similar to 'visual passes', the only difference being the requirement for the objects to be optically visible for observers. This function is useful mainly for predicting satellite passes to be used for radio communications. The quality of the pass depends essentially on the highest elevation value during the pass, which is one of the input parameters.
|
175
|
+
|
176
|
+
|
177
|
+
**API Endpoint**
|
178
|
+
`/radiopasses/{id}/{observer_lat}/{observer_lng}/{observer_alt}/{days}/{min_elevation}`
|
179
|
+
|
180
|
+
**Parameters:**
|
181
|
+
`id` (int): NORAD ID of the satellite
|
182
|
+
`observer_lat` (float): Observer's latitude in decimal degrees
|
183
|
+
`observer_lng` (float): Observer's longitude in decimal degrees
|
184
|
+
`observer_alt` (float): Observer's altitude in meters
|
185
|
+
`days` (int): Number of days to search for passes
|
186
|
+
`min_elevation` (int): Minimum elevation angle (in degrees) to consider the pass valid
|
187
|
+
|
188
|
+
**Returns:**
|
189
|
+
RadioPassesData: A structured object containing radio passes data.
|
190
|
+
|
191
|
+
**Response Fields:**
|
192
|
+
`satid` (int): Same NORAD ID provided in input
|
193
|
+
`satname` (str): Name of the satellite
|
194
|
+
`transactionscount` (int): Number of API transactions in the last hour
|
195
|
+
`passescount` (int): Number of passes returned
|
196
|
+
`startAz` (float): Azimuth at start of pass (degrees)
|
197
|
+
`startAzCompass` (str): Cardinal direction of start azimuth (e.g., N, NE, E)
|
198
|
+
`startUTC` (int): UNIX timestamp of pass start (UTC)
|
199
|
+
`maxAz` (float): Azimuth at max elevation point
|
200
|
+
`maxAzCompass` (str): Cardinal direction of max azimuth
|
201
|
+
`maxEl` (float): Maximum elevation during pass (degrees)
|
202
|
+
`maxUTC` (int): UNIX timestamp of max elevation point (UTC)
|
203
|
+
`endAz` (float): Azimuth at end of pass
|
204
|
+
`endAzCompass` (str): Cardinal direction of end azimuth
|
205
|
+
`endUTC` (int): UNIX timestamp of pass end (UTC)
|
206
|
+
"""
|
207
|
+
|
208
|
+
response = requests.get(url=f'{self.api_url}radiopasses/{id}/{observer_lat}/{observer_lng}/{observer_alt}/{days}/{min_elevation}/', params=self.params)
|
209
|
+
data = response.json()
|
210
|
+
|
211
|
+
if data.get("error") == "Invalid API Key!":
|
212
|
+
raise InvalidApiKey("The API key is invalid or missing.")
|
213
|
+
|
214
|
+
result = from_dict(data_class=RadioPassesData, data=data)
|
215
|
+
return result
|
216
|
+
|
217
|
+
def get_above(
|
218
|
+
self,
|
219
|
+
observer_lat: float,
|
220
|
+
observer_lng: float,
|
221
|
+
observer_alt: float,
|
222
|
+
search_radius: int,
|
223
|
+
category_id: int) -> SatellitesAboveData:
|
224
|
+
|
225
|
+
"""
|
226
|
+
The 'above' function will return all objects within a given search radius above observer's location. The radius (θ), expressed in degrees, is measured relative to the point in the sky directly above an observer (azimuth).
|
227
|
+
|
228
|
+
|
229
|
+
**API Endpoint**
|
230
|
+
/above/{observer_lat}/{observer_lng}/{observer_alt}/{search_radius}/{category_id}
|
231
|
+
|
232
|
+
**Parameters:**
|
233
|
+
observer_lat (float): Latitude in decimal degrees.
|
234
|
+
observer_lng (float): Longitude in decimal degrees.
|
235
|
+
observer_alt (float): Altitude above sea level (in meters).
|
236
|
+
search_radius (int): Search radius in degrees (0–90).
|
237
|
+
category_id (int): Satellite category ID (use 0 for all categories).
|
238
|
+
|
239
|
+
**Returns:**
|
240
|
+
SatellitesAboveData: A structured object containing satellite pass data.
|
241
|
+
|
242
|
+
**Response Fields:**
|
243
|
+
category (str): Category name (e.g., "ANY" if ID = 0)
|
244
|
+
transactionscount (int): API calls in the last 60 minutes
|
245
|
+
satcount (int): Number of satellites returned
|
246
|
+
startAz (float): Start azimuth in degrees
|
247
|
+
satid (int): NORAD satellite ID
|
248
|
+
intDesignator (str): International designator
|
249
|
+
satname (str): Satellite name
|
250
|
+
launchDate (str): Format YYYY-MM-DD
|
251
|
+
satlat (float): Satellite latitude
|
252
|
+
satlng (float): Satellite longitude
|
253
|
+
satalt (float): Satellite altitude (km)
|
254
|
+
"""
|
255
|
+
|
256
|
+
response = requests.get(url=f'{self.api_url}above/{observer_lat}/{observer_lng}/{observer_alt}/{search_radius}/{category_id}/', params=self.params)
|
257
|
+
data = response.json()
|
258
|
+
|
259
|
+
if data.get("error") == "Invalid API Key!":
|
260
|
+
raise InvalidApiKey("The API key is invalid or missing.")
|
261
|
+
|
262
|
+
result = from_dict(data_class=SatellitesAboveData, data=data)
|
263
|
+
|
264
|
+
return result
|
@@ -0,0 +1,252 @@
|
|
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
|
+
|
18
|
+
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
|
19
|
+
<a id="readme-top"></a>
|
20
|
+
<!--
|
21
|
+
*** Thanks for checking out the Best-README-Template. If you have a suggestion
|
22
|
+
*** that would make this better, please fork the repo and create a pull request
|
23
|
+
*** or simply open an issue with the tag "enhancement".
|
24
|
+
*** Don't forget to give the project a star!
|
25
|
+
*** Thanks again! Now go create something AMAZING! :D
|
26
|
+
-->
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
<!-- PROJECT SHIELDS -->
|
31
|
+
<!--
|
32
|
+
*** I'm using markdown "reference style" links for readability.
|
33
|
+
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
|
34
|
+
*** See the bottom of this document for the declaration of the reference variables
|
35
|
+
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
|
36
|
+
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
|
37
|
+
-->
|
38
|
+
[![Forks][forks-shield]][forks-url]
|
39
|
+
[![Stargazers][stars-shield]][stars-url]
|
40
|
+
[![Contributors][contributors-shield]][contributors-url]
|
41
|
+
[![Issues][issues-shield]][issues-url]
|
42
|
+
[![PyPi][pypi-shield]][pypi-url]
|
43
|
+
[![MIT][license-shield]][license-url]
|
44
|
+
|
45
|
+
|
46
|
+
<!-- PROJECT LOGO -->
|
47
|
+
<br />
|
48
|
+
<div align="center">
|
49
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper">
|
50
|
+
<img src="images/logo.png" alt="Logo" width="400">
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<h3 align="center">N2YO.com API Wrapper</h3>
|
54
|
+
|
55
|
+
<p align="center">
|
56
|
+
A lightweight and easy-to-use Python wrapper for the N2YO.com API
|
57
|
+
<br />
|
58
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper"><strong>« Explore the docs »</strong></a>
|
59
|
+
<br />
|
60
|
+
<br />
|
61
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=bug&template=bug-report---.yml">Report Bug</a>
|
62
|
+
·
|
63
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/issues/new?labels=enhancement&template=feature-request---.yml">Request Feature</a>
|
64
|
+
</p>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<!-- TABLE OF CONTENTS -->
|
70
|
+
<details>
|
71
|
+
<summary>Table of Contents</summary>
|
72
|
+
<ol>
|
73
|
+
<li>
|
74
|
+
<a href="#about-the-project">About The Project</a>
|
75
|
+
<ul>
|
76
|
+
<li><a href="#built-with">Built With</a></li>
|
77
|
+
</ul>
|
78
|
+
</li>
|
79
|
+
<li>
|
80
|
+
<a href="#getting-started">Getting Started</a>
|
81
|
+
<ul>
|
82
|
+
<li><a href="#prerequisites">Prerequisites</a></li>
|
83
|
+
<li><a href="#installation">Installation</a></li>
|
84
|
+
</ul>
|
85
|
+
</li>
|
86
|
+
<li><a href="#usage">Usage</a></li>
|
87
|
+
<li><a href="#contributing">Contributing</a></li>
|
88
|
+
<li><a href="#license">License</a></li>
|
89
|
+
<li><a href="#contact">Contact</a></li>
|
90
|
+
</ol>
|
91
|
+
</details>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<!-- ABOUT THE PROJECT -->
|
96
|
+
## ℹ️ About The Project
|
97
|
+
|
98
|
+
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.
|
99
|
+
|
100
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
### Built With
|
105
|
+
|
106
|
+
[![Python][Python]][Python-url]
|
107
|
+
[![requests][requests]][requests-url]
|
108
|
+
[![dacite][dacite]][dacite-url]
|
109
|
+
|
110
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- GETTING STARTED -->
|
115
|
+
## 🟢 Getting Started
|
116
|
+
|
117
|
+
To use the N2YO.com API Wrapper you can clone the repository or use `pip` package (recommended)
|
118
|
+
|
119
|
+
### Prerequisites
|
120
|
+
|
121
|
+
- Python 3.10 or higher
|
122
|
+
- A free API key from [https://www.n2yo.com](https://www.n2yo.com)
|
123
|
+
|
124
|
+
### Installation
|
125
|
+
```sh
|
126
|
+
pip install n2yo-api-wrapper
|
127
|
+
```
|
128
|
+
|
129
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- USAGE EXAMPLES -->
|
134
|
+
## ❓ Usage
|
135
|
+
|
136
|
+
Here’s a basic example of how to use the N2YO API wrapper to track a satellite (e.g., the ISS):
|
137
|
+
|
138
|
+
```python
|
139
|
+
from n2yo import n2yo
|
140
|
+
|
141
|
+
# Initialize the API client with your key
|
142
|
+
wrapper = n2yo(api_key="YOUR_API_KEY")
|
143
|
+
|
144
|
+
# Get real-time position of the ISS (satellite ID: 25544)
|
145
|
+
position = wrapper.get_satellite_positions(
|
146
|
+
id=25544,
|
147
|
+
observer_lat=41.9028, # Latitude (e.g., Rome)
|
148
|
+
observer_lng=12.4964, # Longitude
|
149
|
+
observer_alt=100, # Altitude in meters
|
150
|
+
seconds=1
|
151
|
+
)
|
152
|
+
|
153
|
+
print(position)
|
154
|
+
```
|
155
|
+
|
156
|
+
### 📌 Available Methods
|
157
|
+
|
158
|
+
- `get_satellite_positions(...)` – Get current position of a satellite
|
159
|
+
- `get_tle(satellite_id)` – Retrieve the TLE data
|
160
|
+
- `get_visual_passes(...)` – Get upcoming visible passes
|
161
|
+
- `get_radio_passes(...)` – Get upcoming radio passes
|
162
|
+
- `get_above(...)` – List satellites currently above a location
|
163
|
+
|
164
|
+
_For more examples, please refer to the [Documentation](https://www.n2yo.com/api/)_
|
165
|
+
|
166
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<!-- CONTRIBUTING -->
|
171
|
+
## 🌱 Contributing
|
172
|
+
|
173
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
174
|
+
|
175
|
+
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".
|
176
|
+
Don't forget to give the project a star! Thanks again!
|
177
|
+
|
178
|
+
1. Fork the Project
|
179
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
180
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
181
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
182
|
+
5. Open a Pull Request
|
183
|
+
|
184
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
### Top contributors:
|
189
|
+
|
190
|
+
<a href="https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors">
|
191
|
+
<img src="https://contrib.rocks/image?repo=g1ampy/n2yo-api-wrapper" alt="contrib.rocks image" />
|
192
|
+
</a>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<!-- LICENSE -->
|
197
|
+
## 📜 License
|
198
|
+
|
199
|
+
Distributed under the MIT. See `LICENSE.txt` for more information.
|
200
|
+
|
201
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<!-- CONTACT -->
|
206
|
+
## 📥 Contact
|
207
|
+
|
208
|
+
<a href="mailto:g1ampy@proton.me">
|
209
|
+
<img src="https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white" alt="Gmail">
|
210
|
+
</a>
|
211
|
+
|
212
|
+
<p align="right">(<a href="#readme-top">back to top ⬆️</a>)</p>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
217
|
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
218
|
+
[contributors-shield]: https://img.shields.io/github/contributors/g1ampy/n2yo-api-wrapper.svg
|
219
|
+
[contributors-url]: https://github.com/g1ampy/n2yo-api-wrapper/graphs/contributors
|
220
|
+
[forks-shield]: https://img.shields.io/github/forks/g1ampy/n2yo-api-wrapper.svg
|
221
|
+
[forks-url]: https://github.com/g1ampy/n2yo-api-wrapper/network/members
|
222
|
+
[stars-shield]: https://img.shields.io/github/stars/g1ampy/n2yo-api-wrapper.svg
|
223
|
+
[stars-url]: https://github.com/g1ampy/n2yo-api-wrapper/stargazers
|
224
|
+
[issues-shield]: https://img.shields.io/github/issues/g1ampy/n2yo-api-wrapper.svg
|
225
|
+
[issues-url]: https://github.com/g1ampy/n2yo-api-wrapper/issues
|
226
|
+
[pypi-shield]: https://img.shields.io/pypi/v/n2yo-api-wrapper
|
227
|
+
[pypi-url]: https://pypi.org/project/n2yo-api-wrapper/
|
228
|
+
[license-shield]: https://img.shields.io/github/license/g1ampy/n2yo-api-wrapper.svg
|
229
|
+
[license-url]: https://github.com/g1ampy/n2yo-api-wrapper/blob/stable/LICENSE.txt
|
230
|
+
[product-screenshot]: images/screenshot.png
|
231
|
+
[Next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
|
232
|
+
[Next-url]: https://nextjs.org/
|
233
|
+
[React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
|
234
|
+
[React-url]: https://reactjs.org/
|
235
|
+
[Vue.js]: https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D
|
236
|
+
[Vue-url]: https://vuejs.org/
|
237
|
+
[Angular.io]: https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white
|
238
|
+
[Angular-url]: https://angular.io/
|
239
|
+
[Svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=for-the-badge&logo=svelte&logoColor=FF3E00
|
240
|
+
[Svelte-url]: https://svelte.dev/
|
241
|
+
[Laravel.com]: https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white
|
242
|
+
[Laravel-url]: https://laravel.com
|
243
|
+
[Bootstrap.com]: https://img.shields.io/badge/Bootstrap-563D7C?style=for-the-badge&logo=bootstrap&logoColor=white
|
244
|
+
[Bootstrap-url]: https://getbootstrap.com
|
245
|
+
[JQuery.com]: https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white
|
246
|
+
[JQuery-url]: https://jquery.com
|
247
|
+
[Python]: https://img.shields.io/badge/python-000000?style=for-the-badge&logo=python&logoColor=white
|
248
|
+
[Python-url]: https://python.org/
|
249
|
+
[dacite]: https://img.shields.io/badge/dacite-20232A?style=for-the-badge&logo=github&logoColor=61DAFB
|
250
|
+
[dacite-url]: https://github.com/konradhalas/dacite
|
251
|
+
[requests]: https://img.shields.io/badge/requests-35495E?style=for-the-badge&logo=github&logoColor=4FC08D
|
252
|
+
[requests-url]: https://github.com/psf/requests
|
@@ -0,0 +1,13 @@
|
|
1
|
+
LICENSE.txt
|
2
|
+
README.md
|
3
|
+
setup.py
|
4
|
+
n2yo/__init__.py
|
5
|
+
n2yo/exceptions.py
|
6
|
+
n2yo/n2yo.py
|
7
|
+
n2yo/models/__init__.py
|
8
|
+
n2yo/models/search.py
|
9
|
+
n2yo_api_wrapper.egg-info/PKG-INFO
|
10
|
+
n2yo_api_wrapper.egg-info/SOURCES.txt
|
11
|
+
n2yo_api_wrapper.egg-info/dependency_links.txt
|
12
|
+
n2yo_api_wrapper.egg-info/requires.txt
|
13
|
+
n2yo_api_wrapper.egg-info/top_level.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
n2yo
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from setuptools import find_packages, setup
|
2
|
+
|
3
|
+
with open("README.md", "r", encoding="utf-8") as readme_file:
|
4
|
+
long_description = readme_file.read()
|
5
|
+
|
6
|
+
setup(
|
7
|
+
name="n2yo-api-wrapper",
|
8
|
+
version="0.0.1",
|
9
|
+
description="Unofficial Wrapper for N2YO.com API",
|
10
|
+
author="Giampy",
|
11
|
+
author_email="g1ampy@proton.me",
|
12
|
+
packages=find_packages(),
|
13
|
+
url="https://github.com/g1ampy/n2yo-api-wrapper",
|
14
|
+
python_requires=">=3.10",
|
15
|
+
install_requires=["requests", "dacite", "beautifulsoup4"],
|
16
|
+
long_description=long_description,
|
17
|
+
long_description_content_type="text/markdown",
|
18
|
+
license="MIT",
|
19
|
+
classifiers=[
|
20
|
+
"Development Status :: 4 - Beta",
|
21
|
+
"Programming Language :: Python",
|
22
|
+
"Operating System :: OS Independent",
|
23
|
+
"Intended Audience :: Developers",
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
25
|
+
],
|
26
|
+
)
|