Marine Traffic Client Api
Project description
Marine Traffic API Client Python Library
Installation
Works on python 3.x.
pip install marine-traffic-client-api
Usage
from marinetrafficapi import MarineTrafficApi
# initialize API
api = MarineTrafficApi(api_key="__your_api_key_here__")
# fetch ship routes
routes = api.routes(port_start_id=1,
port_target_id=10,
include_alternatives=True,
include_in_land=True)
# iterate over the routes
for route in routes:
route.distance
route.panama
route.suez
route.final_path
# fetch vessel positions
vessel_positions = api.vessel_track(period='daily',
days=3,
mmsi=241486000)
# iterate over positions
for position in vessel_positions:
position.mmsi
position.status
position.speed
position.longitude
position.latitude
position.course
position.heading
position.timestamp
position.ship_id
position.wind_angle
Debugging
If you want to debug your code using the data regarding the API call.
# initialize with debug=True
api = MarineTrafficApi(api_key="...", debug=True)
# after every API call the client library will automatically print all the data to standard output
api.routes(...)
# and you can always have all debug data in your code
debug_data = api.request.debug.show()
Official documentation
For more information visit official documentation: https://www.marinetraffic.com/en/ais-api-services/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for Marine_Traffic_API-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d77e6558b63b01727f6f3f1a36ecf0dba69450308258098cdb110e38159dd96 |
|
MD5 | 8281449f80cc90607dd85695fe3de7f7 |
|
BLAKE2b-256 | 567b549a0122760ce6c0c7b2819e9166e64909e62b8a676fc3143f0e89ee8729 |