TypeError: list indices must be integers or slices, not str

I come across this error during my code execution from time to time. If I immediately re-run the code, the error is not encountered. The error arises from the line "order_book=fyers.orders(token=token)['data']['orderBook']". It is a straight forward piece of code.

Can someone help me to resolve this issue?

 

3 replies