You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, I tried to to access the models with berth_calls.models but this resulted in a TypeError, i.e.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [22], in <cell line: 1>()
----> 1 berth_calls.models
File ~\Anaconda3\lib\site-packages\marinetrafficapi\response.py:52, in Response.models(self)
49 if not self._response_data[ClientConst.MODELS]:
50 formatted_data = self.formatter.format(self._data)
51 self._response_data[ClientConst.MODELS] = \
---> 52 self._model.process(
53 self.formatter.to_list(formatted_data))
55 return self._response_data[ClientConst.MODELS]
File ~\Anaconda3\lib\site-packages\marinetrafficapi\models.py:38, in Model.process(cls, data)
32 # check if the model property
33 # is an instance of Field class
34 if isinstance(property_object, Field):
35
36 # convert raw property data into corespondent
37 # data type defined by the Field class
---> 38 property_object.convert_item(model_object)
40 # set model property value with formatted data
41 setattr(model_object, model_property,
42 deepcopy(property_object))
File ~\Anaconda3\lib\site-packages\marinetrafficapi\fields.py:22, in Field.convert_item(self, model)
19 """Convert item to desired item type"""
21 try:
---> 22 self.value = model.item[self._index]
23 except IndexError:
24 self.value = None
TypeError: list indices must be integers or slices, not str
The text was updated successfully, but these errors were encountered:
My hypothesis is that because I chose json as the returned structure and it automatically chose an array/list representation, things got messed up. Maybe I must keep it as xml or choose jsono? The list version is irritating anyways as I can only guess which entry means what...
I issued a request as described in https://github.com/amphinicy/marine-traffic-client-api#ev03-berth-calls
Then, I tried to to access the models with
berth_calls.models
but this resulted in a TypeError, i.e.The text was updated successfully, but these errors were encountered: