Skip to main content

Marine Traffic Client Api

Project description

Marine Traffic API Client Python Library

PyPI version

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


Download files

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

Source Distribution

Marine Traffic API-0.2.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

Marine_Traffic_API-0.2.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file Marine Traffic API-0.2.1.tar.gz.

File metadata

  • Download URL: Marine Traffic API-0.2.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

File hashes

Hashes for Marine Traffic API-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6b3b34e6ed1561532b484b4c3beccc9260475339c549cc9d7c95ecb4f5e1ff18
MD5 40306c46b3d30258b866c050912650dc
BLAKE2b-256 a3ad769059a256e7c06e651ecc2641d8564f3aa16f4252f7361cd8f65acf943d

See more details on using hashes here.

File details

Details for the file Marine_Traffic_API-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: Marine_Traffic_API-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

File hashes

Hashes for Marine_Traffic_API-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55fbf4f1bde729d80fd786a2168fb889c9e49d7c0557b839b18df126325e6dc0
MD5 9006f3fdfa2db8b8f071dcba6742d592
BLAKE2b-256 cbac54828fba86c592e8ec8c43f9ceb3a5b6f731299a798555445bc038fb8307

See more details on using hashes here.

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