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

Work around issues with urllib and LIST request method #773

Open
ethanhs opened this issue Oct 3, 2021 · 1 comment
Open

Work around issues with urllib and LIST request method #773

ethanhs opened this issue Oct 3, 2021 · 1 comment

Comments

@ethanhs
Copy link

ethanhs commented Oct 3, 2021

When using hvac I ran into an issue where I kept getting 400: Bad Request when I tried to list secrets.

The following gives me a 400:

from urllib.request import Request, urlopen
urlopen(Request(url='https://server/v1/mount/metadata/folder', headers={'X-Vault-Token': 'my-token'}, method='LIST'))

However using the list=true query parameter and GET:

from urllib.request import Request, urlopen
urlopen(Request(url='https://server/v1/mount/metadata/folder?list=true', headers={'X-Vault-Token': 'my-token'}, method='GET'))

The request works fine.

I've been able to reproduce this issue across Linux/Python 3.7 and Windows/Python 3.9

Could hvac switch to using the query parameter to work around this issue?

@tommyzli
Copy link

If you initialize hvac.Client with strict_http=True, it will rewrite the LIST requests as GETs with the list query parameter: #689

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