Marine Traffic Client Api
Project description
Marine Traffic API Client Python Library
Installation
Works on python 3.x.
pip install Marine-Traffic-API
Initialize API
from marinetrafficapi import MarineTrafficApi
api = MarineTrafficApi(api_key="__your_api_key_here__")
[VI03] Port Distance and Routes
routes = api.routes(port_start_id=1,
port_target_id=10,
include_alternatives=True,
include_in_land=True,
protocol='json'|'jsono'|'csv'|'xml')
routes.raw_data # raw data from api call (json, csv or xml)
routes.formatted_data # data list
routes.models # list of Client models representing the data
for route in routes.models:
route.distance
route.panama
route.suez
route.final_path
[PS01] Vessel History Track
vessel_positions = api.vessel_track(period='daily',
days=3,
mmsi=241486000)
for position in vessel_positions.models:
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.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55fbf4f1bde729d80fd786a2168fb889c9e49d7c0557b839b18df126325e6dc0 |
|
MD5 | 9006f3fdfa2db8b8f071dcba6742d592 |
|
BLAKE2b-256 | cbac54828fba86c592e8ec8c43f9ceb3a5b6f731299a798555445bc038fb8307 |