Skip to main content

Python client for the Vessel Tracking API — maritime vessel tracking, port events, emissions, and navigation data.

Project description

vesselapi-python

CI PyPI Python License: MIT

Python client for the Vessel Tracking API — maritime vessel tracking, port events, emissions, and navigation data.

Resources: Documentation | API Explorer | Dashboard | Contact Support

Install

pip install vessel-api-python

Requires Python 3.9+.

Quick Start

from vessel_api_python import VesselClient

client = VesselClient(api_key="your-api-key")

# Search for a vessel by name.
result = client.search.vessels(filter_name="Ever Given")
for v in result.vessels or []:
    print(f"{v.name} (IMO {v.imo})")

# Get a port by UN/LOCODE.
port = client.ports.get("NLRTM")
print(port.port.name)

# Auto-paginate through port events.
for event in client.port_events.list_all(pagination_limit=10):
    print(f"{event.event} at {event.timestamp}")

Async

import asyncio
from vessel_api_python import AsyncVesselClient

async def main():
    async with AsyncVesselClient(api_key="your-api-key") as client:
        result = await client.search.vessels(filter_name="Ever Given")
        async for event in client.port_events.list_all(pagination_limit=10):
            print(f"{event.event} at {event.timestamp}")

asyncio.run(main())

Available Services

Service Methods Description
vessels get, position, casualties, classification, emissions, eta, inspections, inspection_detail, ownership, positions Vessel details, positions, and records
ports get Port lookup by UN/LOCODE
port_events list, by_port, by_ports, by_vessel, last_by_vessel, by_vessels Vessel arrival/departure events
emissions list EU MRV emissions data
search vessels, ports, dgps, light_aids, modus, radio_beacons Full-text search across entity types
location vessels_bounding_box, vessels_radius, ports_bounding_box, ports_radius, dgps_bounding_box, dgps_radius, light_aids_bounding_box, light_aids_radius, modus_bounding_box, modus_radius, radio_beacons_bounding_box, radio_beacons_radius Geo queries by bounding box or radius
navtex list NAVTEX maritime safety messages

37 methods total.

Vessel Lookup & Location

# Get vessel details by IMO number (defaults to IMO; pass filter_id_type="mmsi" for MMSI).
vessel = client.vessels.get("9811000")
print(f"{vessel.vessel.name} ({vessel.vessel.vessel_type})")

# Get the vessel's latest AIS position.
pos = client.vessels.position("9811000")
print(f"Position: {pos.vessel_position.latitude}, {pos.vessel_position.longitude}")

# Find all vessels within 10 km of Rotterdam.
nearby = client.location.vessels_radius(latitude=51.9225, longitude=4.47917, radius=10000)
for v in nearby.vessels or []:
    print(f"{v.vessel_name} at {v.latitude}, {v.longitude}")

Error Handling

All methods raise specific exception types on non-2xx responses:

from vessel_api_python import VesselAPIError

try:
    client.ports.get("ZZZZZ")
except VesselAPIError as err:
    if err.is_not_found:
        print("Port not found")
    elif err.is_rate_limited:
        print("Rate limited — back off")
    elif err.is_auth_error:
        print("Check API key")
    print(err.status_code, err.message)

Auto-Pagination

Every list endpoint has an all_* / list_all variant returning an iterator:

# Sync
for vessel in client.search.all_vessels(filter_vessel_type="Tanker"):
    print(vessel.name)

# Async
async for vessel in client.search.all_vessels(filter_vessel_type="Tanker"):
    print(vessel.name)

# Collect a bounded set at once
vessels = client.search.all_vessels(filter_vessel_type="Tanker", pagination_limit=50).collect()

Configuration

client = VesselClient(
    api_key="your-api-key",
    base_url="https://custom-endpoint.example.com/v1",
    timeout=60.0,
    max_retries=5,  # default: 3
    user_agent="my-app/1.0",
)

Retries use exponential backoff with jitter on 429 and 5xx responses. The Retry-After header is respected.

Documentation

Contributing & Support

Found a bug, have a feature request, or need help? You're welcome to open an issue. For API-level bugs and feature requests, please use the main VesselAPI repository.

For security vulnerabilities, do not open a public issue — email security@vesselapi.com instead. See SECURITY.md.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vessel_api_python-1.3.0.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vessel_api_python-1.3.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file vessel_api_python-1.3.0.tar.gz.

File metadata

  • Download URL: vessel_api_python-1.3.0.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vessel_api_python-1.3.0.tar.gz
Algorithm Hash digest
SHA256 5ac96e93b5d11eeaac43d37604aa8589d828bbf472f2f88a1af85d0d71e1cd8b
MD5 623da58c54a9ffc7a2a834bff2ebccf9
BLAKE2b-256 482e72258a46edcf8a4d3f8273043ea9cdca122f580975be6afa2ad75af2d873

See more details on using hashes here.

Provenance

The following attestation bundles were made for vessel_api_python-1.3.0.tar.gz:

Publisher: publish.yml on vessel-api/vesselapi-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vessel_api_python-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vessel_api_python-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a1be02f9a6eeaf0e80c369932aafc2362fedf37e0ef868a8e9b66e68893b06b
MD5 536484fe74afa17395bf3e0dbe5d2b8f
BLAKE2b-256 d0b4cbc03dce686bc4b5ff8395f9756dacd83c9e0f61b9fe266cbd2b63ab1480

See more details on using hashes here.

Provenance

The following attestation bundles were made for vessel_api_python-1.3.0-py3-none-any.whl:

Publisher: publish.yml on vessel-api/vesselapi-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page