amphinicy / marine-traffic-client-api

A python client for Marine Traffic API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PS07 example code won't work

orangefabri opened this issue · comments

Hello.

I followed simple example code on your website :
https://pypi.org/project/Marine-Traffic-API/

class AISWorker(QThread):
    ui_text_signal = pyqtSignal(str, str)
    ui_color_signal = pyqtSignal(str, str)

    def __init__(self):
        super().__init__()
        self.api = MarineTrafficApi(api_key="deleted for privacy reason")
        # time_span = The maximum age, in minutes, of the returned positions.
        # Maximum value for terrestrial coverage is 60.
        # Maximum value for satellite coverage is 180.
        self.vessel = self.api.single_vessel_positions(time_span=20, mmsi=441577000)
        # Mega Trust mmsi = 441577000
        MarineTrafficApi.print_params_for('single_vessel_positions')
        self.vessel = self.vessel.models[0]
        self.alive = True

I executed this code and get this result :

self.vessel = self.vessel.models[0]
IndexError: list index out of range

my key is for single vessel positions. I can check my profile on marine traffic website and api key is still valid.