You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the README when showing using the clients on their own, we are missing the requester argument.
fromdjango_github_app.githubimportAsyncGitHubAPIfromdjango_github_app.modelsimportInstallation# Access public endpoints without authenticationasyncdefget_public_repo():
asyncwithAsyncGitHubAPI() asgh:
returnawaitgh.getitem("/repos/django/django")
# Interact as the GitHub App installationasyncdefcreate_comment(repo_full_name: str):
# Get the installation for the repositoryinstallation=awaitInstallation.objects.aget(
repositories__full_name=repo_full_name
)
asyncwithAsyncGitHubAPI(installation_id=installation.installation_id) asgh:
awaitgh.post(
f"/repos/{repo_full_name}/issues/1/comments", data={"body": "Hello!"}
)
# You can either provide the `installation_id` as above, or the `Installation` instance# itselfasyncwithAsyncGitHubAPI(installation=installation) asgh:
awaitgh.post(
f"/repos/{repo_full_name}/issues/1/comments", data={"body": "World!"}
)
In both cases, we are just providing a thin layer over gidgethub.abc.GitHubAPI with support for the Installation model and an opinionated use of httpx as the HTTP client. So we still need to provide all the arguments that the abstract base GitHubAPI expects, namely requester: str as the first argument to the class.
Corrected documentation example:
fromdjango_github_app.githubimportAsyncGitHubAPIfromdjango_github_app.modelsimportInstallation# Access public endpoints without authenticationasyncdefget_public_repo():
asyncwithAsyncGitHubAPI("example-github-app") asgh:
returnawaitgh.getitem("/repos/django/django")
In the webhook view, we grab it from the app_settings.SLUG so it's not a problem there.
Either we can update the documentation to indicate this or mirror the webhook view and use app_settings.SLUG. Or, maybe even better than that, allow for providing a custom requester and if one is not provided, fallback to the app_settings.SLUG.
The text was updated successfully, but these errors were encountered:
In the README when showing using the clients on their own, we are missing the
requester
argument.In both cases, we are just providing a thin layer over
gidgethub.abc.GitHubAPI
with support for theInstallation
model and an opinionated use ofhttpx
as the HTTP client. So we still need to provide all the arguments that the abstract baseGitHubAPI
expects, namelyrequester: str
as the first argument to the class.Corrected documentation example:
In the webhook view, we grab it from the
app_settings.SLUG
so it's not a problem there.Either we can update the documentation to indicate this or mirror the webhook view and use
app_settings.SLUG
. Or, maybe even better than that, allow for providing a customrequester
and if one is not provided, fallback to theapp_settings.SLUG
.The text was updated successfully, but these errors were encountered: