Skip to content

Commit

Permalink
Documentation improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniessink committed Sep 6, 2024
1 parent 3b9c09b commit f7f60a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def _get_pull_request_response(
"owner": self._parameter("owner"),
},
)
json = await response.json()
json = await response.json(content_type=None)
if repository := json["data"]["repository"]:
page_info = repository["pullRequests"]["pageInfo"]
return response, page_info["hasNextPage"], page_info.get("endCursor", "")
Expand All @@ -105,13 +105,13 @@ async def _parse_entities(self, responses: SourceResponses) -> Entities:
"""Override to parse the pull requests."""
pull_requests = []
for response in responses:
json = await response.json()
json = await response.json(content_type=None)
pull_requests.extend(json["data"]["repository"]["pullRequests"]["nodes"])
return Entities(self._create_entity(pr) for pr in pull_requests)

async def _parse_total(self, responses: SourceResponses) -> Value:
"""Override to parse the total number of pull requests."""
return str((await responses[0].json())["data"]["repository"]["pullRequests"]["totalCount"])
return str((await responses[0].json(content_type=None))["data"]["repository"]["pullRequests"]["totalCount"])

def _create_entity(self, pull_request) -> Entity:
"""Create an entity from a GitHub JSON pull request."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
url=HttpUrl("https://github.com/about"),
parameters={
"url": URL(
name="GitHub instance URL",
help="URL of the GitHub instance, with port if necessary, but without path. For example, "
"'https://github.com'.",
name="GitHub instance API-URL",
help="API-URL of the GitHub instance, with port if necessary, but without path. For example, "
"'https://api.github.com'.",
validate_on=["private_token"],
metrics=ALL_GITHUB_METRICS,
),
Expand All @@ -56,7 +56,8 @@
metrics=ALL_GITHUB_METRICS,
),
"private_token": PrivateToken(
name="Fine-grained personal access token (with read scope of the repository)",
name="Fine-grained personal access token with repository permission 'Pull requests' set to "
"access level 'Read-only'.",
short_name="Personal access token",
help_url=HttpUrl(
"https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/"
Expand Down

0 comments on commit f7f60a4

Please sign in to comment.