Can't get custom component to create a new entry in .storage

Does anyone have a moment to cast their eyes over this?

It’s a fork of the nationalrail component, where I’m trying to standardise storage and usage of the API token, the sensor loads, but I get

Traceback (most recent call last):
  File "/config/custom_components/nationalrailuk/client.py", line 264, in async_get_data
    data = self.process_data(raw_data)
  File "/config/custom_components/nationalrailuk/client.py", line 203, in process_data
    expected_arrival = rebuild_date(time_base, dest["st"])
                                               ~~~~^^^^^^
TypeError: string indices must be integers, not 'str'

and Error validating API token: unexpected data from api

Since you are developing. Set a break point on that line of code and see what the data is.

Wild guess: dest is an array rather than a dictionary.