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

Remove need to URL-quote some parameters #54

Closed
choldgraf opened this issue Apr 26, 2021 · 4 comments
Closed

Remove need to URL-quote some parameters #54

choldgraf opened this issue Apr 26, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@choldgraf
Copy link

choldgraf commented Apr 26, 2021

I just found a gotcha where I was trying to update a github label that had a space in it. Trying to do so was raising a 400 error. I fixed it by doing:

from urllib.parse import quote
quote(label["name"])

It would be helpful to either automate this under-the-hood, or to raise a more helpful error that suggests this might be the issue.

@hamelsmu
Copy link
Contributor

Do you mind sharing the full code of what you were trying to do with an example of what failed? This would help greatly! I can then use this directly in the docs!

@choldgraf
Copy link
Author

Sure - for example, let's say I wanted to update this label:

https://github.com/jupyterhub/nativeauthenticator/labels/help%20wanted

to help-wanted (instead of help wanted)

if I ran:

api.issues.update_label("jupyterhub", "nativeauthenticator", "help wanted", "help-wanted")

I get

HTTP400BadRequestError: HTTP Error 400: Bad Request

if instead I run

api.issues.update_label("jupyterhub", "nativeauthenticator", quote("help wanted"), "help-wanted")

then it works

@choldgraf
Copy link
Author

This doesn't always happen for things that have spaces in them (e.g., I am able to set labels on issues with spaces in them without escaping them), but for some reason the error pops up sometimes

@jph00 jph00 changed the title Document the need to URL-quote some parameters Remove need to URL-quote some parameters Jul 10, 2021
@jph00
Copy link
Contributor

jph00 commented Jul 10, 2021

Thanks for the report @choldgraf . I've just pushed a update so you now don't need to URL-quote some parameters.

@jph00 jph00 added the enhancement New feature or request label Jul 10, 2021
@jph00 jph00 closed this as completed in e397722 Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants