Metadata-Version: 2.0
Name: fleetmonger
Version: 0.0.3
Summary: Fleetmon API wrapper for ship data
Home-page: https://github.com/fitnr/fleetmonger
Author: Neil Freeman
Author-email: contact@fakeisthenewreal.org
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Intended Audience :: Science/Research
Requires-Dist: requests (>=2.4.1,<3)
Requires-Dist: pytz (==2014.10)

Fleetmonger
-----------

Python wrapper for the `fleetmon.com <fleetmon.com>`__ ship-tracking
API.

API Calls
---------

`Read the details of the API at
Fleetmonger <https://www.fleetmon.com/faq/public_api>`__. \*
fleetmonger.myfleet \* fleetmonger.vessel \*
fleetmonger.vesselparticulars \* fleetmonger.vesselurl \*
fleetmonger.porturl \* fleetmonger.weather \*
fleetmonger.containerschedule

Note that some API calls require the purchase of credits at Fleetmon.
This package is unaffiliated with Fleetmon, use at your own risk.

Usage
=====

.. code:: python

    from fleetmonger import Fleetmonger

    fm = Fleetmonger('username', 'your key')

    fleet = fm.myfleet()

    for ship in fleet:
        print ship.name, ship.destination

Vessels
~~~~~~~

.. code:: python


    my_vessel = fleet[0]
    # or
    my_vessel = fm.vessel(mmsi='239725000')
    # or
    my_vessel = fm.vessel(imo='9197545')
    # or
    my_vessel = fm.vessel(name='MINNOW')

    # Passing incomplete information will raise an error
    my_vessel = fm.vessel()
    # ValueError

    my_vessel.name
    # <SS MINNOW>

    my_vessel.navigationstatus
    # 'On a three hour tour'

    my_vessel.etatime
    # datetime.datetime(1964, 9, 26, 12, 0, tzinfo=<UTC>)

    my_vessel.coords
    # (3.469557, -167.255859)

    # Missing attributes return None
    my_vessel.location
    # None

    my_vessel.flag
    # 'United States'

    my_vessel.flag_so
    # 'US'

    # Some vessels have photos
    myvessel.photos
    # ["//img1.fleetmon.com/thumbnails/MINNOW_1.220x146.jpg", "//img1.fleetmon.com/thumbnails/MINNOW_2.570x1140.jpg"]

Minimum list of ``Vessel`` attributes:

``coords`` (lat, lon), ``course``, ``destination``, ``draught``,
``etatime``, ``flag``, ``heading``, ``imo``, ``last_port``,
``latitude``, ``location``, ``longitude``, ``mmsi``, ``name``,
``navigationstatus``, ``photos``, ``positionreceived``, ``publicurl``,
``speed``, ``type``

Ports
~~~~~

.. code:: python


    my_vessel.last_port
    # <fleetmonger.port.Port object>

    port = my_vessel.last_port

    port.name
    # 'Honolulu, HI'

    port.duration
    # datetime.timedelta(...)

Port urls and Vessel urls
~~~~~~~~~~~~~~~~~~~~~~~~~

Pass mmsi, imo or name to vessel methods. Pass locode or name to port
methods.

.. code:: python

    fm.vesselurl(name='MINNOW')

    fm.porturl(locode='USLAX')

    # Porturl also takes an optional country isocode parameter 
    fm.porturl(name='new', country='US')
    # [<Newark (New York)>, <Newburgh>, <Newburyport>, <Newport (OR)>]

Weather at Location
~~~~~~~~~~~~~~~~~~~

.. code:: python

    fm.weather(lat=3.469557, lon=-167.255859)

    # You can also pass a vessel object to the weather call
    fm.weather(vessel=my_vessel)

Parameters
----------

In general, the parameters that Fleetmonger expects match those of the
Fleetmon API, with the following exceptions:

::

    instead of mmsinumber, use mmsi
    ...        imonumber   ... imo
    ...        q           ... name



