vessel-api-python 2.0.0__tar.gz → 2.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.
@@ -3,6 +3,44 @@
3
3
  All notable changes to this package are documented here.
4
4
  This project follows [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [2.1.0] - 2026-10-26
7
+
8
+ ### Added
9
+
10
+ - `VesselPositionResponse` has three new fields, which the API returns on every
11
+ position response since 25 October 2026: `vessel` (a `Vessel`, as from
12
+ `vessels.get()`), `vessel_eta` (a `VesselETA`, as from `vessels.eta()`) and
13
+ `position_check` (the new `PositionCheck` model). `vessel` and `vessel_eta`
14
+ are `None` when the API holds no record for them. Earlier versions drop these
15
+ keys when parsing.
16
+ - `PositionCheck` compares the position with the vessel's previous report from
17
+ the last 80 hours (`previous_position`, the new `PreviousPosition` model). It
18
+ gives the time and great-circle distance since then, and the speed and course
19
+ that would cover that distance. It also says whether that speed is more than
20
+ 1.2 times the vessel's usual top speed, and whether the MMSI and IMO match.
21
+ - `vessels.position()` takes `filter_sat_lookback_minutes` and
22
+ `filter_sat_max_age_minutes`, which set the satellite fallback's time windows.
23
+ Both the sync and async clients have them.
24
+
25
+ ### Changed
26
+
27
+ - The bundled OpenAPI spec is synced with the API.
28
+
29
+ ## [2.0.1] - 2026-10-08
30
+
31
+ Documentation only. No method, parameter or model changed.
32
+
33
+ ### Fixed
34
+
35
+ - The bundled OpenAPI spec named the satellite fallback parameter `sat`; the
36
+ API's parameter is `filter.sat`. Descriptions corrected.
37
+
38
+ ### Changed
39
+
40
+ - README: the satellite fallback note says when it fires (no recent terrestrial
41
+ position stored); the radius example describes the time window it searches
42
+ (default 2 hours, at most 4).
43
+
6
44
  ## [2.0.0] - 2026-08-16
7
45
 
8
46
  Vessel ownership, classification and inspection data, and NAVTEX messages, were
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: vessel-api-python
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Python client for the Vessel Tracking API: maritime vessel tracking, port events, emissions, and nautical infrastructure.
5
5
  Project-URL: Documentation, https://vesselapi.com/docs
6
6
  Project-URL: Repository, https://github.com/vessel-api/vesselapi-python
@@ -131,11 +131,12 @@ print(f"{vessel.vessel.name} ({vessel.vessel.vessel_type})")
131
131
  pos = client.vessels.position("232003239", filter_id_type="mmsi")
132
132
  print(f"Position: {pos.vessel_position.latitude}, {pos.vessel_position.longitude}")
133
133
 
134
- # filter_sat=True falls back to satellite AIS when nothing is stored.
134
+ # filter_sat=True falls back to satellite AIS when no recent terrestrial position is stored.
135
135
  # ⚠️ Satellite lookups draw on a prepaid balance and are charged per call.
136
136
  # Omit it unless you need that fallback.
137
137
 
138
- # Find all vessels within 10 km of Rotterdam.
138
+ # Find vessels with an AIS position within 10 km of Rotterdam in the last 2 hours
139
+ # (the default time window, at most 4 hours).
139
140
  nearby = client.location.vessels_radius(latitude=51.9225, longitude=4.47917, radius=10000)
140
141
  for v in nearby.vessels or []:
141
142
  print(f"{v.vessel_name} at {v.latitude}, {v.longitude}")
@@ -97,11 +97,12 @@ print(f"{vessel.vessel.name} ({vessel.vessel.vessel_type})")
97
97
  pos = client.vessels.position("232003239", filter_id_type="mmsi")
98
98
  print(f"Position: {pos.vessel_position.latitude}, {pos.vessel_position.longitude}")
99
99
 
100
- # filter_sat=True falls back to satellite AIS when nothing is stored.
100
+ # filter_sat=True falls back to satellite AIS when no recent terrestrial position is stored.
101
101
  # ⚠️ Satellite lookups draw on a prepaid balance and are charged per call.
102
102
  # Omit it unless you need that fallback.
103
103
 
104
- # Find all vessels within 10 km of Rotterdam.
104
+ # Find vessels with an AIS position within 10 km of Rotterdam in the last 2 hours
105
+ # (the default time window, at most 4 hours).
105
106
  nearby = client.location.vessels_radius(latitude=51.9225, longitude=4.47917, radius=10000)
106
107
  for v in nearby.vessels or []:
107
108
  print(f"{v.vessel_name} at {v.latitude}, {v.longitude}")
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vessel-api-python"
7
- version = "2.0.0"
7
+ version = "2.1.0"
8
8
  description = "Python client for the Vessel Tracking API: maritime vessel tracking, port events, emissions, and nautical infrastructure."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -45,6 +45,8 @@ from ._models import (
45
45
  PortReference,
46
46
  PortResponse,
47
47
  PortsWithinLocationResponse,
48
+ PositionCheck,
49
+ PreviousPosition,
48
50
  RadioBeacon,
49
51
  RadioBeaconsWithinLocationResponse,
50
52
  ResolutionMeta,
@@ -96,6 +98,8 @@ __all__ = [
96
98
  "VesselResponse",
97
99
  "VesselPosition",
98
100
  "VesselPositionResponse",
101
+ "PositionCheck",
102
+ "PreviousPosition",
99
103
  "VesselPositionsResponse",
100
104
  "MarineCasualty",
101
105
  "MarineCasualtiesResponse",
@@ -1,6 +1,6 @@
1
1
  """Constants for the Vessel API Python SDK."""
2
2
 
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  DEFAULT_BASE_URL = "https://api.vesselapi.com/v1"
5
5
  DEFAULT_USER_AGENT = f"vesselapi-python/{VERSION}"
6
6
  DEFAULT_MAX_RETRIES = 3
@@ -144,10 +144,40 @@ class VesselPosition(_Base):
144
144
  vessel_name: str | None = None
145
145
 
146
146
 
147
+ class PreviousPosition(_Base):
148
+ """The vessel's newest position report before the served one."""
149
+
150
+ latitude: float | None = None
151
+ longitude: float | None = None
152
+ timestamp: str | None = None
153
+
154
+
155
+ class PositionCheck(_Base):
156
+ """How the served position compares with the vessel's previous position report.
157
+
158
+ Only ``lookback_hours`` is present when no previous report falls within it.
159
+ """
160
+
161
+ previous_position: PreviousPosition | None = None
162
+ minutes_since_previous: int | None = None
163
+ distance_nm: float | None = None
164
+ implied_speed_kn: float | None = None
165
+ implied_course: int | None = None
166
+ exceeds_typical_speed: bool | None = None
167
+ identity_match: bool | None = None
168
+ lookback_hours: int | None = None
169
+
170
+
147
171
  class VesselPositionResponse(_Base):
148
- """Response for a single vessel position lookup."""
172
+ """Response for a single vessel position lookup.
173
+
174
+ ``vessel`` and ``vessel_eta`` are ``None`` when the API holds no record for them.
175
+ """
149
176
 
150
177
  vessel_position: VesselPosition | None = Field(default=None, alias="vesselPosition")
178
+ vessel: Vessel | None = None
179
+ vessel_eta: VesselETA | None = Field(default=None, alias="vesselEta")
180
+ position_check: PositionCheck | None = Field(default=None, alias="positionCheck")
151
181
  meta: ResolutionMeta | None = Field(default=None, alias="_meta")
152
182
 
153
183
 
@@ -94,15 +94,32 @@ class VesselsService:
94
94
  return VesselResponse.model_validate(r.json())
95
95
 
96
96
  def position(
97
- self, vessel_id: str, *, filter_id_type: str = "imo", filter_sat: bool | None = None
97
+ self,
98
+ vessel_id: str,
99
+ *,
100
+ filter_id_type: str = "imo",
101
+ filter_sat: bool | None = None,
102
+ filter_sat_lookback_minutes: int | None = None,
103
+ filter_sat_max_age_minutes: int | None = None,
98
104
  ) -> VesselPositionResponse:
99
105
  """Retrieve the latest position for a vessel.
100
106
 
101
107
  ``filter_sat`` enables satellite AIS fallback; the server defaults it to false.
108
+ With ``filter_sat=True``, ``filter_sat_lookback_minutes`` (60 to 4800, default 180)
109
+ sets how old a satellite fix may be and still be returned.
110
+ ``filter_sat_max_age_minutes`` (15 to 4800, default 60, paid plans only) sets how
111
+ old a stored position may be before a satellite lookup is made.
102
112
  """
103
113
  r = self._client.get(
104
114
  f"/vessel/{vessel_id}/position",
105
- params=_strip_none({"filter.idType": filter_id_type, "filter.sat": filter_sat}),
115
+ params=_strip_none(
116
+ {
117
+ "filter.idType": filter_id_type,
118
+ "filter.sat": filter_sat,
119
+ "filter.satLookbackMinutes": filter_sat_lookback_minutes,
120
+ "filter.satMaxAgeMinutes": filter_sat_max_age_minutes,
121
+ }
122
+ ),
106
123
  )
107
124
  error_from_response(r.status_code, r.content)
108
125
  return VesselPositionResponse.model_validate(r.json())
@@ -1561,15 +1578,32 @@ class AsyncVesselsService:
1561
1578
  return VesselResponse.model_validate(r.json())
1562
1579
 
1563
1580
  async def position(
1564
- self, vessel_id: str, *, filter_id_type: str = "imo", filter_sat: bool | None = None
1581
+ self,
1582
+ vessel_id: str,
1583
+ *,
1584
+ filter_id_type: str = "imo",
1585
+ filter_sat: bool | None = None,
1586
+ filter_sat_lookback_minutes: int | None = None,
1587
+ filter_sat_max_age_minutes: int | None = None,
1565
1588
  ) -> VesselPositionResponse:
1566
1589
  """Retrieve the latest position for a vessel.
1567
1590
 
1568
1591
  ``filter_sat`` enables satellite AIS fallback; the server defaults it to false.
1592
+ With ``filter_sat=True``, ``filter_sat_lookback_minutes`` (60 to 4800, default 180)
1593
+ sets how old a satellite fix may be and still be returned.
1594
+ ``filter_sat_max_age_minutes`` (15 to 4800, default 60, paid plans only) sets how
1595
+ old a stored position may be before a satellite lookup is made.
1569
1596
  """
1570
1597
  r = await self._client.get(
1571
1598
  f"/vessel/{vessel_id}/position",
1572
- params=_strip_none({"filter.idType": filter_id_type, "filter.sat": filter_sat}),
1599
+ params=_strip_none(
1600
+ {
1601
+ "filter.idType": filter_id_type,
1602
+ "filter.sat": filter_sat,
1603
+ "filter.satLookbackMinutes": filter_sat_lookback_minutes,
1604
+ "filter.satMaxAgeMinutes": filter_sat_max_age_minutes,
1605
+ }
1606
+ ),
1573
1607
  )
1574
1608
  error_from_response(r.status_code, r.content)
1575
1609
  return VesselPositionResponse.model_validate(r.json())