Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Response object is not subscriptable" when using Identity create operations #538

Open
acritelli opened this issue Oct 24, 2019 · 1 comment

Comments

@acritelli
Copy link

I'm following the exact example here: https://hvac.readthedocs.io/en/stable/usage/secrets_engines/identity.html#create-or-update-entity

When running this, it results in the following on initial creation:

Entity ID for "hvac-entity" is: bb58d8a8-7a7d-0938-66e2-392c04c5ead5
Traceback (most recent call last):
  File "./vault-certificate-importer.py", line 103, in <module>
    entity_id = create_response['data']['id']
TypeError: 'Response' object is not subscriptable

Running it again then results in a similar error, but this time without the ID printed at all:

Traceback (most recent call last):
  File "./vault-certificate-importer.py", line 81, in <module>
    entity_id = create_response['data']['id']
TypeError: 'Response' object is not subscriptable

I'm just running testing this out with the default example code in that doc:

create_response = client.secrets.identity.create_or_update_entity(
                name='hvac-entity',
                metadata=dict(extra_datas='yup'),
        )
entity_id = create_response['data']['id']
print('Entity ID for "hvac-entity" is: {id}'.format(id=entity_id))

I'm running hvac version 0.9.5 installed via pip, and Python 3.6.8:

fsh$ pip3 list | grep hvac
hvac                       0.9.5              
You are using pip version 19.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

fsh$ python3 --version
Python 3.6.8

Is there another way this should be done? Should the docs be updated to reflect a different way of accessing data when calling this functions?

So far, I've only noticed this on the entity (including by name), but I haven't tested with other things. I feel like the same behavior would manifest.

@shreyasmoolya09
Copy link

shreyasmoolya09 commented Sep 16, 2020

I get the same error with list_secrets_result = client.secrets.kv.v1.list_secrets(path='hvac')

 keys=','.join(list_secrets_result['data']['keys']),
TypeError: 'Response' object is not subscriptable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants