[Answered ]-How to solve "'int' object is not subscriptable" in Django from a Kraken API

1πŸ‘

βœ…

I think the issue is the with the last item in the "result" array of arrays – "last". It seems like it’s just a number. I guess you need some type checking in the algorithm.
enter image description here

Suggestion for code modification:

for i in data['result'].values():
  # Skips "last" attribute
  if isinstance(i, int):
    continue
  kraken_data = Krak(
    time_0=(i[0][0]),
  )
  kraken_data.save()
πŸ‘€vinkomlacic

Leave a comment