amphinicy / marine-traffic-client-api

A python client for Marine Traffic API
MIT License
25 stars 3 forks source link

PS07 example code won't work #65

Open ghost opened 2 years ago

ghost commented 2 years ago

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

ghost commented 2 years ago

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