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?

Hi @vishnu_bharath which version of the APIs are you using?

Still using V1. I don’t think they have rolled out V2 yet.

You can access V2 here - https://api-docs.fyers.in/v2/#what-is-fyers-api