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

Path parameters are not url encoded #595

Open
ktekelioglu opened this issue Aug 3, 2022 · 0 comments · May be fixed by #597
Open

Path parameters are not url encoded #595

ktekelioglu opened this issue Aug 3, 2022 · 0 comments · May be fixed by #597

Comments

@ktekelioglu
Copy link

What happened?

This was discovered in the palantir-python-sdk library: palantir/palantir-python-sdk#20

Python classes generated by this library have a bug when a special character is encountered in a path parameter. The example in the above issue is a branch parameter with a '/' character.

What did you want to happen?

Path parameters should be url encoded. It can be done with a simple utility function as such:

def format_path_with_params(path, path_params):
    escaped_path_params = {
        k: requests.utils.quote(v, safe="") for k, v in path_params.items()
    }
    return path.format(**escaped_path_params)
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

Successfully merging a pull request may close this issue.

1 participant