pyopensky 2.6__tar.gz → 2.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyopensky
3
- Version: 2.6
3
+ Version: 2.8
4
4
  Summary: A Python interface for OpenSky database
5
5
  Home-page: https://github.com/open-aviation/pyopensky/
6
6
  License: MIT
@@ -14,9 +14,9 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: appdirs (>=1.4.4)
17
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
17
18
  Requires-Dist: minio (>=7.1)
18
19
  Requires-Dist: pandas (>=1.5)
19
- Requires-Dist: paramiko (>=2.7)
20
20
  Requires-Dist: pyarrow (>=11.0.0)
21
21
  Requires-Dist: pyjwt (>=2.7.0)
22
22
  Requires-Dist: tqdm (>=4.65.0)
@@ -29,7 +29,7 @@ Description-Content-Type: text/markdown
29
29
 
30
30
  The `pyopensky` Python library provides functions to download data from the OpenSky Network live API and historical databases. It aims at making ADS-B and Mode S data from OpenSky easily accessible in the Python programming environment.
31
31
 
32
- Full documentation on [https://open-aviation.github.io/pyopensky](https://open-aviation.github.io/pyopensky)
32
+ Full documentation on <https://open-aviation.github.io/pyopensky>
33
33
 
34
34
  ## Installation
35
35
 
@@ -1,9 +1,12 @@
1
1
  [tool.poetry]
2
2
  name = "pyopensky"
3
- version = "2.6"
3
+ version = "2.8"
4
4
  description = "A Python interface for OpenSky database"
5
5
  repository = "https://github.com/open-aviation/pyopensky/"
6
- authors = ["Xavier Olive <git@xoolive.org>", "Junzi Sun <j.sun-1@tudelft.nl>"]
6
+ authors = [
7
+ "Xavier Olive <git@xoolive.org>",
8
+ "Junzi Sun <j.sun-1@tudelft.nl>"
9
+ ]
7
10
  license = "MIT"
8
11
  readme = "readme.md"
9
12
  include = [
@@ -21,7 +24,7 @@ tqdm = ">=4.65.0"
21
24
  pyarrow = ">=11.0.0"
22
25
  typing-extensions = ">=4.5.0"
23
26
  pyjwt = ">=2.7.0"
24
- paramiko = ">=2.7"
27
+ httpx = "^0.27.0"
25
28
 
26
29
  [tool.poetry.group.dev.dependencies]
27
30
  pre-commit = ">=3.1.1"
@@ -29,8 +32,6 @@ mypy = ">=1.0.1"
29
32
  ruff = ">=0.0.253"
30
33
  pytest = ">=7.2.1"
31
34
  ipykernel = ">=6.21.2"
32
- types-requests = ">=2.28.11.15"
33
- types-paramiko = ">=3.3.0.0"
34
35
  Sphinx = ">=5.1"
35
36
  sphinx-design = ">=0.4.1"
36
37
  sphinx-rtd-theme = ">=0.5.2"
@@ -2,7 +2,7 @@
2
2
 
3
3
  The `pyopensky` Python library provides functions to download data from the OpenSky Network live API and historical databases. It aims at making ADS-B and Mode S data from OpenSky easily accessible in the Python programming environment.
4
4
 
5
- Full documentation on [https://open-aviation.github.io/pyopensky](https://open-aviation.github.io/pyopensky)
5
+ Full documentation on <https://open-aviation.github.io/pyopensky>
6
6
 
7
7
  ## Installation
8
8
 
@@ -18,11 +18,11 @@ DEFAULT_CONFIG = """
18
18
  username =
19
19
  password =
20
20
 
21
- # If you use both Impala and Trino, uncomment the following
22
- # [impala]
23
- # username =
24
- # password =
25
- #
21
+ # Uncomment the following if you have access to the s3 server
22
+ # secret_key =
23
+ # access_key =
24
+
25
+ # If you need a different account on Trino, uncomment the following
26
26
  # [trino]
27
27
  # username =
28
28
  # password =
@@ -98,6 +98,7 @@ class Resolution(TypedDict, total=False):
98
98
  NAME_RESOLUTION: dict[str, Resolution] = {
99
99
  # Cache configuration
100
100
  "cache_dir": dict(
101
+ environment_variable="OPENSKY_CACHE",
101
102
  opensky_category="cache",
102
103
  opensky_name="path",
103
104
  traffic_category="cache",
@@ -111,12 +112,6 @@ NAME_RESOLUTION: dict[str, Resolution] = {
111
112
  traffic_category="network",
112
113
  traffic_name="http_proxy",
113
114
  ),
114
- "ssh_proxycommand": dict(
115
- opensky_category="impala",
116
- opensky_name="ssh.proxycommand",
117
- traffic_category="opensky",
118
- traffic_name="ssh.proxycommand",
119
- ),
120
115
  # Credentials configuration
121
116
  "access_key": dict(
122
117
  opensky_category="s3",
@@ -154,16 +149,6 @@ NAME_RESOLUTION: dict[str, Resolution] = {
154
149
  opensky_category="trino",
155
150
  opensky_name="password",
156
151
  ),
157
- "impala_username": dict(
158
- environment_variable="OPENSKY_IMPALA_USERNAME",
159
- opensky_category="impala",
160
- opensky_name="username",
161
- ),
162
- "impala_password": dict(
163
- environment_variable="OPENSKY_IMPALA_PASSWORD",
164
- opensky_category="impala",
165
- opensky_name="password",
166
- ),
167
152
  }
168
153
 
169
154
  __all__ = list(NAME_RESOLUTION.keys())
@@ -219,16 +204,6 @@ def __getattr__(name: str) -> None | str:
219
204
  return value
220
205
  return get_config(**NAME_RESOLUTION["password"])
221
206
 
222
- if name == "impala_username":
223
- if value := get_config(**NAME_RESOLUTION[name]):
224
- return value
225
- return get_config(**NAME_RESOLUTION["username"])
226
-
227
- if name == "impala_password":
228
- if value := get_config(**NAME_RESOLUTION[name]):
229
- return value
230
- return get_config(**NAME_RESOLUTION["password"])
231
-
232
207
  if name in __all__:
233
208
  return get_config(**NAME_RESOLUTION[name])
234
209
 
@@ -6,7 +6,7 @@ from datetime import timedelta
6
6
  from json import JSONDecodeError
7
7
  from typing import Any, cast
8
8
 
9
- import requests
9
+ import httpx
10
10
 
11
11
  import pandas as pd
12
12
 
@@ -55,7 +55,7 @@ class REST:
55
55
  self.password = password
56
56
  self.auth = cast(tuple[str, str], (username, password))
57
57
 
58
- self.session = requests.Session()
58
+ self.client = httpx.Client()
59
59
 
60
60
  def states(
61
61
  self,
@@ -120,7 +120,7 @@ class REST:
120
120
 
121
121
  what += f"?lamin={south}&lamax={north}&lomin={west}&lomax={east}"
122
122
 
123
- c = self.session.get(
123
+ c = self.client.get(
124
124
  f"https://opensky-network.org/api/states/{what}", auth=self.auth
125
125
  )
126
126
  try:
@@ -185,7 +185,7 @@ class REST:
185
185
 
186
186
  """
187
187
  time = int(to_datetime(time).timestamp()) if time is not None else 0
188
- c = self.session.get(
188
+ c = self.client.get(
189
189
  f"https://opensky-network.org/api/tracks/"
190
190
  f"?icao24={icao24}&time={time}"
191
191
  )
@@ -208,7 +208,7 @@ class REST:
208
208
 
209
209
  def routes(self, callsign: str) -> tuple[str, str]:
210
210
  """Returns the route associated to a callsign."""
211
- c = self.session.get(
211
+ c = self.client.get(
212
212
  f"https://opensky-network.org/api/routes?callsign={callsign}"
213
213
  )
214
214
  c.raise_for_status()
@@ -243,7 +243,7 @@ class REST:
243
243
  else:
244
244
  end_ts = to_datetime(end)
245
245
 
246
- c = self.session.get(
246
+ c = self.client.get(
247
247
  f"https://opensky-network.org/api/flights/aircraft"
248
248
  f"?icao24={icao24}&begin={begin_ts.timestamp():.0f}&"
249
249
  f"end={end_ts.timestamp():.0f}"
@@ -276,7 +276,7 @@ class REST:
276
276
  today = pd.Timestamp("now", tz="utc").floor("1d")
277
277
  if day is not None:
278
278
  today = to_datetime(day)
279
- c = self.session.get(
279
+ c = self.client.get(
280
280
  f"https://opensky-network.org/api/sensor/myStats"
281
281
  f"?days={today.timestamp():.0f}",
282
282
  auth=self.auth,
@@ -298,7 +298,7 @@ class REST:
298
298
  day = pd.Timestamp("now", tz="utc").floor("1d")
299
299
  day_ts = to_datetime(day)
300
300
 
301
- c = self.session.get(
301
+ c = self.client.get(
302
302
  f"https://opensky-network.org/api/range/days?"
303
303
  f"days={day_ts.timestamp():.0f}&serials={serial}"
304
304
  )
@@ -314,7 +314,7 @@ class REST:
314
314
  day = pd.Timestamp("now", tz="utc").floor("1d")
315
315
  day_ts = to_datetime(day)
316
316
 
317
- c = self.session.get(
317
+ c = self.client.get(
318
318
  f"https://opensky-network.org/api/range/coverage?"
319
319
  f"day={day_ts.timestamp():.0f}"
320
320
  )
@@ -353,7 +353,7 @@ class REST:
353
353
  else:
354
354
  end_ts = to_datetime(end)
355
355
 
356
- c = self.session.get(
356
+ c = self.client.get(
357
357
  f"https://opensky-network.org/api/flights/arrival"
358
358
  f"?begin={begin_ts.timestamp():.0f}&airport={airport}&"
359
359
  f"end={end_ts.timestamp():.0f}"
@@ -413,7 +413,7 @@ class REST:
413
413
  else:
414
414
  end_ts = to_datetime(end)
415
415
 
416
- c = self.session.get(
416
+ c = self.client.get(
417
417
  f"https://opensky-network.org/api/flights/departure"
418
418
  f"?begin={begin_ts.timestamp():.0f}&airport={airport}&"
419
419
  f"end={end_ts.timestamp():.0f}"
@@ -8,8 +8,8 @@ from multiprocessing.pool import ThreadPool
8
8
  from operator import or_
9
9
  from typing import Any, Iterable, Type, TypedDict, cast
10
10
 
11
+ import httpx
11
12
  import jwt
12
- import requests
13
13
  from sqlalchemy import (
14
14
  Connection,
15
15
  CursorResult,
@@ -77,7 +77,7 @@ class Trino(OpenSkyDBAPI):
77
77
  return self._token["access_token"]
78
78
 
79
79
  _log.info("Requesting authentication token")
80
- result = requests.post(
80
+ result = httpx.post(
81
81
  "https://auth.opensky-network.org/auth/realms/"
82
82
  "opensky-network/protocol/openid-connect/token",
83
83
  data={
@@ -297,7 +297,7 @@ class Trino(OpenSkyDBAPI):
297
297
  else start_ts + pd.Timedelta("1d")
298
298
  )
299
299
 
300
- stmt = select(Table).with_only_columns( # type: ignore
300
+ stmt = select(Table).with_only_columns(
301
301
  Table.icao24,
302
302
  Table.firstseen,
303
303
  Table.estdepartureairport,
@@ -308,21 +308,17 @@ class Trino(OpenSkyDBAPI):
308
308
  *(extra_columns if extra_columns is not None else []),
309
309
  )
310
310
 
311
- stmt = self.stmt_where_str(stmt, icao24, Table.icao24) # type: ignore
312
- stmt = self.stmt_where_str(
313
- stmt,
314
- callsign,
315
- Table.callsign, # type: ignore
316
- )
311
+ stmt = self.stmt_where_str(stmt, icao24, Table.icao24)
312
+ stmt = self.stmt_where_str(stmt, callsign, Table.callsign)
317
313
  stmt = self.stmt_where_str(
318
314
  stmt,
319
315
  departure_airport,
320
- Table.estdepartureairport, # type: ignore
316
+ Table.estdepartureairport,
321
317
  )
322
318
  stmt = self.stmt_where_str(
323
319
  stmt,
324
320
  arrival_airport,
325
- Table.estarrivalairport, # type: ignore
321
+ Table.estarrivalairport,
326
322
  )
327
323
  if airport is not None and arrival_airport is not None:
328
324
  raise RuntimeError("airport may not be set if arrival_airport is")
@@ -331,8 +327,8 @@ class Trino(OpenSkyDBAPI):
331
327
  stmt = self.stmt_where_str(
332
328
  stmt,
333
329
  airport,
334
- Table.estdepartureairport, # type: ignore
335
- Table.estarrivalairport, # type: ignore
330
+ Table.estdepartureairport,
331
+ Table.estarrivalairport,
336
332
  )
337
333
 
338
334
  if departure_airport is not None: