Request for assistance with 'NoneType' object error in smartAPI login


  • I am encountering while attempting to login to smartAPI using my server environment. The error message reads "TypeError: 'NoneType' object is not subscriptable".

    This error occurs specifically when the script executes the following line:

    authToken = data['data']['jwtToken']
    

    The 'data' variable is expected to be a dictionary containing a nested dictionary with a key of 'jwtToken'. However, instead, the variable is being populated with the value 'None'. This is causing the indexing operation using square brackets to fail.

    I have reviewed the server-side code and verified that the authentication process is successful. I have also ensured that the network connectivity is stable and that the API endpoint is accessible. However, the error persists.

    I have also checked the working script on my laptop and observed that the 'data' variable is correctly populated with the required information. This suggests that there might be a discrepancy between the environment on my laptop and the server environment.