title: TypeError: list indices must be integers or slices, not str Using Python
body: <p>I am still learning stuff through python and would like your help.</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;context&quot;: {
      &quot;authnAttemptId&quot;: &quot;14fee7f5-2f81-448c-a0ca-41558eb68b8f&quot;,
      &quot;messageId&quot;: &quot;e1d8e981-5b71-4434-b92e-182f1706dd95&quot;,
      &quot;inResponseTo&quot;: &quot;42dd9ss&quot;
    },
    &quot;credentialValidationResults&quot;: [
      {
        &quot;methodId&quot;: &quot;APPROVE&quot;,
        &quot;methodResponseCode&quot;: &quot;IN_PROCESS&quot;,
        &quot;methodReasonCode&quot;: &quot;VERIFICATION_PENDING:&quot;,
        &quot;authnAttributes&quot;: []
      }
    ],
    &quot;attemptResponseCode&quot;: &quot;CHALLENGE&quot;,
    &quot;attemptReasonCode&quot;: &quot;METHOD_VERIFY_IN_PROCESS&quot;,
    &quot;challengeMethods&quot;: {
      &quot;challenges&quot;: [
        {
          &quot;methodSetId&quot;: &quot;850e5638-54c5-4429-9fa8-e48da2594736&quot;,
          &quot;requiredMethods&quot;: [
            {
              &quot;methodId&quot;: &quot;APPROVE&quot;,
              &quot;displayName&quot;: &quot;Approve&quot;,
              &quot;priority&quot;: 1,
              &quot;versions&quot;: [
                {
                  &quot;versionId&quot;: &quot;1.0.0&quot;,
                  &quot;methodAttributes&quot;: [
                    {
                      &quot;name&quot;: &quot;deviceName&quot;,
                      &quot;value&quot;: &quot;DESKTOP-P1S563M&quot;,
                      &quot;dataType&quot;: &quot;STRING&quot;
                    }
                  ],
                  &quot;valueRequired&quot;: false,
                  &quot;referenceId&quot;: &quot;14fee7f5-2f81-448c-a0ca-41558eb68b8f:P6JQ&quot;,
                  &quot;prompt&quot;: {
                    &quot;promptResourceId&quot;: &quot;IA.Resource.Prompt.Approve&quot;,
                    &quot;defaultText&quot;: &quot;Initiate Approve? &quot;,
                    &quot;formatRegex&quot;: null,
                    &quot;defaultValue&quot;: null,
                    &quot;valueBeingDefined&quot;: false,
                    &quot;sensitive&quot;: true,
                    &quot;minLength&quot;: null,
                    &quot;maxLength&quot;: null,
                    &quot;promptArgs&quot;: []
                  }
                }
              ]
            }
          ]
        },
        {
          &quot;methodSetId&quot;: &quot;3dd02306-212e-47e2-b14f-cf0bb6f87e4d&quot;,
          &quot;requiredMethods&quot;: [
            {
              &quot;methodId&quot;: &quot;FINGERPRINT&quot;,
              &quot;displayName&quot;: &quot;Device Biometrics&quot;,
              &quot;priority&quot;: 50,
              &quot;versions&quot;: [
                {
                  &quot;versionId&quot;: &quot;1.0.0&quot;,
                  &quot;methodAttributes&quot;: [
                    {
                      &quot;name&quot;: &quot;deviceName&quot;,
                      &quot;value&quot;: &quot;DESKTOP-P1S563M&quot;,
                      &quot;dataType&quot;: &quot;STRING&quot;
                    }
                  ],
                  &quot;valueRequired&quot;: false,
                  &quot;referenceId&quot;: null,
                  &quot;prompt&quot;: {
                    &quot;promptResourceId&quot;: &quot;IA.Resource.Prompt.Fingerprint&quot;,
                    &quot;defaultText&quot;: &quot;Initiate Fingerprint? &quot;,
                    &quot;formatRegex&quot;: null,
                    &quot;defaultValue&quot;: null,
                    &quot;valueBeingDefined&quot;: false,
                    &quot;sensitive&quot;: true,
                    &quot;minLength&quot;: null,
                    &quot;maxLength&quot;: null,
                    &quot;promptArgs&quot;: []
                  }
                }
              ]
            }
          ]
        },
        {
          &quot;methodSetId&quot;: &quot;649243db-928e-42ac-b009-42ca278c0a75&quot;,
          &quot;requiredMethods&quot;: [
            {
              &quot;methodId&quot;: &quot;FIDOTOKEN_INITIALIZE_CHALLENGE&quot;,
              &quot;displayName&quot;: &quot;FIDO Challenge&quot;,
              &quot;priority&quot;: 50,
              &quot;versions&quot;: [
                {
                  &quot;versionId&quot;: &quot;1.0.0&quot;,
                  &quot;methodAttributes&quot;: [
                    {
                      &quot;name&quot;: &quot;METHOD_NOT_APPLICABLE&quot;,
                      &quot;value&quot;: &quot;DEVICE_NOT_CAPABLE&quot;,
                      &quot;dataType&quot;: &quot;STRING&quot;
                    }
                  ],
                  &quot;valueRequired&quot;: false,
                  &quot;referenceId&quot;: null,
                  &quot;prompt&quot;: {
                    &quot;promptResourceId&quot;: &quot;IA.Resource.Prompt.Fido_Initialize_Challenge&quot;,
                    &quot;defaultText&quot;: &quot;Start FIDO Authentication? &quot;,
                    &quot;formatRegex&quot;: null,
                    &quot;defaultValue&quot;: null,
                    &quot;valueBeingDefined&quot;: false,
                    &quot;sensitive&quot;: true,
                    &quot;minLength&quot;: null,
                    &quot;maxLength&quot;: null,
                    &quot;promptArgs&quot;: []
                  }
                }
              ]
            }
          ]
        },
        {
          &quot;methodSetId&quot;: &quot;d896e4e8-49ef-48fd-a232-8a3c3d7e97b0&quot;,
          &quot;requiredMethods&quot;: [
            {
              &quot;methodId&quot;: &quot;TOKEN&quot;,
              &quot;displayName&quot;: &quot;Authenticate Tokencode&quot;,
              &quot;priority&quot;: 50,
              &quot;versions&quot;: [
                {
                  &quot;versionId&quot;: &quot;1.0.0&quot;,
                  &quot;methodAttributes&quot;: [
                    {
                      &quot;name&quot;: &quot;deviceName&quot;,
                      &quot;value&quot;: &quot;DESKTOP-P1S563M&quot;,
                      &quot;dataType&quot;: &quot;STRING&quot;
                    }
                  ],
                  &quot;valueRequired&quot;: true,
                  &quot;referenceId&quot;: null,
                  &quot;prompt&quot;: {
                    &quot;promptResourceId&quot;: &quot;IA.Resource.Prompt.Token&quot;,
                    &quot;defaultText&quot;: &quot;Enter Tokencode: &quot;,
                    &quot;formatRegex&quot;: null,
                    &quot;defaultValue&quot;: null,
                    &quot;valueBeingDefined&quot;: false,
                    &quot;sensitive&quot;: true,
                    &quot;minLength&quot;: null,
                    &quot;maxLength&quot;: null,
                    &quot;promptArgs&quot;: []
                  }
                }
              ]
            }
          ]
        },
        {
          &quot;methodSetId&quot;: &quot;5324cd43-62eb-4b55-acdb-93d0079a79a9&quot;,
          &quot;requiredMethods&quot;: [
            {
              &quot;methodId&quot;: &quot;EMERGENCY_TOKENCODE&quot;,
              &quot;displayName&quot;: &quot;Emergency Tokencode&quot;,
              &quot;priority&quot;: 100,
              &quot;versions&quot;: [
                {
                  &quot;versionId&quot;: &quot;1.0.0&quot;,
                  &quot;methodAttributes&quot;: [
                    {
                      &quot;name&quot;: &quot;METHOD_NOT_APPLICABLE&quot;,
                      &quot;value&quot;: &quot;METHOD_NOT_ENROLLED&quot;,
                      &quot;dataType&quot;: &quot;STRING&quot;
                    }
                  ],
                  &quot;valueRequired&quot;: true,
                  &quot;referenceId&quot;: null,
                  &quot;prompt&quot;: {
                    &quot;promptResourceId&quot;: &quot;IA.Resource.Prompt.Emergency_Tokencode&quot;,
                    &quot;defaultText&quot;: &quot;Enter your Emergency Tokencode: &quot;,
                    &quot;formatRegex&quot;: &quot;^[a-zA-Z0-9]{8}$&quot;,
                    &quot;defaultValue&quot;: null,
                    &quot;valueBeingDefined&quot;: false,
                    &quot;sensitive&quot;: true,
                    &quot;minLength&quot;: 8,
                    &quot;maxLength&quot;: 12,
                    &quot;promptArgs&quot;: []
                  }
                }
              ]
            }
          ]
        },
        {
          &quot;methodSetId&quot;: &quot;1e2046ad-1c4e-4045-b30c-d39c1a48db86&quot;,
          &quot;requiredMethods&quot;: [
            {
              &quot;methodId&quot;: &quot;SECURID&quot;,
              &quot;displayName&quot;: &quot;RSA SecurID&quot;,
              &quot;priority&quot;: 50,
              &quot;versions&quot;: [
                {
                  &quot;versionId&quot;: &quot;1.0.0&quot;,
                  &quot;methodAttributes&quot;: [],
                  &quot;valueRequired&quot;: true,
                  &quot;referenceId&quot;: null,
                  &quot;prompt&quot;: {
                    &quot;promptResourceId&quot;: &quot;IA.Resource.Prompt.SecurId_Passcode&quot;,
                    &quot;defaultText&quot;: &quot;Enter PASSCODE: &quot;,
                    &quot;formatRegex&quot;: null,
                    &quot;defaultValue&quot;: null,
                    &quot;valueBeingDefined&quot;: false,
                    &quot;sensitive&quot;: true,
                    &quot;minLength&quot;: null,
                    &quot;maxLength&quot;: null,
                    &quot;promptArgs&quot;: []
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  }
  </code></pre>
  <p>So what I am doing is I want to get the value present in this JSON response which is the reference: 14fee7f5-2f81-448c-a0ca-41558eb68b8f:P6JQ</p>
  <p>so I am using the following command in python:</p>
  <pre class="lang-py prettyprint-override"><code>result2 = response2.json()
  reference_id_approve = result2['challengeMethods']['challenges']['methodSetId']['requiredMethods']['versions']['referenceId']
  </code></pre>
  <p>However, I am getting the error TypeError: list indices must be integers or slices.</p>
  <p>Appreciate your help :)</p>