aisdb.webdata.marinetraffic module

read vessel information such as deadweight tonnage from a local marinetraffic.com metadata database.

Web scraping support was removed (see GitHub issue #81): marinetraffic.com anti-bot measures and paywall make scraping unsupportable. Existing local traffic databases remain fully readable.

class aisdb.webdata.marinetraffic.VesselInfo(trafficDBpath, verbose=False)[source]

Bases: object

read vessel metadata from a local marinetraffic database.

opens (creating it first if missing) the local traffic database at trafficDBpath. the open connection is available as the trafficDB attribute. use as a context manager, or call close(), to release the connection.

Parameters:

trafficDBpath (string) – path to the local vessel traffic metadata database

close()[source]
vessel_info_callback(mmsis, retry_404=False, infotxt='')[source]

check that metadata exists in the local database for the given MMSI identifiers.

raises RuntimeError when identifiers are missing from the local database, since retrieving them would require web scraping, which was removed (GitHub issue #81).

Parameters:

mmsis (list) – list of MMSI identifiers (integers)

aisdb.webdata.marinetraffic.vessel_info(tracks, dbconn: Connection)[source]

append vessel metadata from a local marinetraffic database to track dictionaries.

Parameters:
  • tracks (iter) – collection of track dictionaries

  • dbconn (sqlite3.Connection) – connection to the local traffic database, e.g. the aisdb.webdata.marinetraffic.VesselInfo.trafficDB attribute