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

Support parameters #79

Open
asmeurer opened this issue Mar 24, 2019 · 2 comments
Open

Support parameters #79

asmeurer opened this issue Mar 24, 2019 · 2 comments

Comments

@asmeurer
Copy link

I originally thought that the second argument of things like getitem was parameters (this should be documented better). It seems they have to be added manually.

Here is an example of a GitHub API call that has a parameter https://developer.github.com/v3/repos/contents/#get-contents.

@brettcannon
Copy link
Collaborator

I originally thought that the second argument of things like getitem was parameters (this should be documented better).

Please feel free to open a separate issue -- or even a PR 😉 -- about this, although the documentation for the argument does specify it's for URL templating.

It seems they have to be added manually.

Correct. There's no explicit URL parameter support.

I'm of two minds on this one. One is that adding parameters is not hard and you have to specify the URL anyway, so this isn't preventing anyone from being productive. But obviously it would be convenient for those cases where parameters are necessary.

So I guess if someone wants to propose adding a keyword-only url_parameters argument that takes a Mapping[str, str] then I would be willing to consider it.

@asmeurer
Copy link
Author

I didn't notice it is mentioned in the docstring of the class. I was looking at the docstring of the individual method (like getitem). I think it would be helpful to put a blurb about it on each method's docstring.

One is that adding parameters is not hard and you have to specify the URL anyway, so this isn't preventing anyone from being productive.

I suppose that's true in the general case. I'm using it for a GitHub bot which responds to webhooks, so I never actually create API URLs myself. The main URL comes from an event, and I get the additional URLs from the API itself (like event.data['pull_request']['base']['repo']['contents_url'] ).

Also building the URL by hand isn't necessarily trivial (you have to remember to properly quote the parameter arguments, for instance).

By the way, I guess my intuition for parameters being the second argument comes from requests, where the second argument to get is params.

@brettcannon brettcannon added the area-REST GitHub REST API label Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants