Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,34 @@ Changelog
Unreleased
----------

- Make :meth:`gidgethub.abc.GitHubAPI.getiter` be iterative instead of
recursive
(`PR #219 <https://github.com/gidgethub/gidgethub/pull/219>`_)

- :meth:`gidgethub.apps.get_jwt` now accepts an ``expiration`` parameter to
configure JWT token expiration time
(`PR #215 <https://github.com/gidgethub/gidgethub/pull/215>`_)

- Add support for Python 3.12-3.13 and drop EOL Python 3.7
(`PR #209 <https://github.com/brettcannon/gidgethub/pull/209>`_)
(`PR #209 <https://github.com/gidgethub/gidgethub/pull/209>`_)

5.3.0
-----

- Add support passing ``extra_headers`` when making requests
(`PR #192 <https://github.com/brettcannon/gidgethub/pull/192>`_)
(`PR #192 <https://github.com/gidgethub/gidgethub/pull/192>`_)

- Add a getstatus() method for APIs that do not return content.
(`PR #194 <https://github.com/brettcannon/gidgethub/pull/194>`_)
(`PR #194 <https://github.com/gidgethub/gidgethub/pull/194>`_)

5.2.1
-----

- Fix cgi and importlib_resources deprecations.
(`PR #185 <https://github.com/brettcannon/gidgethub/pull/185>`_)
(`PR #185 <https://github.com/gidgethub/gidgethub/pull/185>`_)

- Add support for Python 3.11 and drop EOL Python 3.6
(`PR #184 <https://github.com/brettcannon/gidgethub/pull/184>`_)
(`PR #184 <https://github.com/gidgethub/gidgethub/pull/184>`_)

5.2.0
-----
Expand All @@ -38,17 +42,17 @@ Unreleased
-----

- Use ``X-Hub-Signature-256`` header for webhook validation when available.
(`PR #160 <https://github.com/brettcannon/gidgethub/pull/160>`_).
(`PR #160 <https://github.com/gidgethub/gidgethub/pull/160>`_).

- The documentation is now built using Sphinx v>= 4.0.0.
(`Issue #143 <https://github.com/brettcannon/gidgethub/issues/143>`_)
(`Issue #143 <https://github.com/gidgethub/gidgethub/issues/143>`_)

- :meth:`gidgethub.abc.GitHubAPI.getiter` now accepts ``iterable_key`` parameter
in order to support the Checks API.
(`Issue #164 <https://github.com/brettcannon/gidgethub/issues/164>`_)
(`Issue #164 <https://github.com/gidgethub/gidgethub/issues/164>`_)

- Accept HTTP 202 ACCEPTED as successful.
(`PR #174 <https://github.com/brettcannon/gidgethub/pull/174>`_)
(`PR #174 <https://github.com/gidgethub/gidgethub/pull/174>`_)

5.0.1
-----
Expand All @@ -64,15 +68,15 @@ Unreleased

- Add :meth:`gidgethub.routing.Router.fetch` for obtaining a frozenset of functions
registered to the router that the event would be called on.
(`Issue #74 <https://github.com/brettcannon/gidgethub/issues/74>`_).
(`Issue #74 <https://github.com/gidgethub/gidgethub/issues/74>`_).
- Add support for GitHub Actions Environment Files with :meth:`gidgethub.actions.setenv`
and :meth:`gidgethub.actions.addpath`.
(`Issue #137 <https://github.com/brettcannon/gidgethub/issues/132>`_).
(`Issue #137 <https://github.com/gidgethub/gidgethub/issues/132>`_).
- Make router callback execution order non-deterministic to avoid relying on
registration order.
(`Issue #74 <https://github.com/brettcannon/gidgethub/issues/74>`_).
(`Issue #74 <https://github.com/gidgethub/gidgethub/issues/74>`_).
- Fix mypy errors in ``gidgethub.httpx.GitHubAPI._request``
(`Issue #133 <https://github.com/brettcannon/gidgethub/issues/133>`_).
(`Issue #133 <https://github.com/gidgethub/gidgethub/issues/133>`_).
- Make the minimum version of PyJWT be v2.0.0.

4.2.0
Expand All @@ -82,17 +86,17 @@ Unreleased
If supplied, the ``content_type`` value will be used in the request headers,
and the raw form of the data will be passed to the request. If not supplied,
by default the data will be parsed as JSON, and the "application/json" content
type will be used. (`Issue #115 <https://github.com/brettcannon/gidgethub/issues/115>`_).
type will be used. (`Issue #115 <https://github.com/gidgethub/gidgethub/issues/115>`_).

4.1.1
-----

- Fix :meth:`gidgethub.abc.GitHubAPI.graphql` to accept response content types lacking
spaces; affects GitHub Enterprise
(`Issue #122 <https://github.com/brettcannon/gidgethub/pull/122>`_)
(`Issue #122 <https://github.com/gidgethub/gidgethub/pull/122>`_)

- Specify PyJWT[crypto] as a dependency, and dropped the explicit dependency to
``cryptography`` (`Issue #116 <https://github.com/brettcannon/gidgethub/issues/116>`_).
``cryptography`` (`Issue #116 <https://github.com/gidgethub/gidgethub/issues/116>`_).

4.1.0
-----
Expand All @@ -101,7 +105,7 @@ Unreleased

- Introduce :meth:`gidgethub.apps.get_installation_access_token`
for obtaining an installation access token that can be used to authenticate as
a GitHub App installation. (`Issue #71 <https://github.com/brettcannon/gidgethub/issues/71>`_).
a GitHub App installation. (`Issue #71 <https://github.com/gidgethub/gidgethub/issues/71>`_).

- Introduce :meth:`gidgethub.apps.get_jwt` for constructing the JSON Web Token
that can be used to access endpoints that require it.
Expand All @@ -118,7 +122,7 @@ Unreleased
- Remove `gidgethub.test` from the distribution.
- Introduce :mod:`gidgethub.actions`.
- Add :exc:`gidgethub.ValidationError` for when the HTTP response is a 422 but not
field-related. (`#83 <https://github.com/brettcannon/gidgethub/pull/83>`_;
field-related. (`#83 <https://github.com/gidgethub/gidgethub/pull/83>`_;
thanks `John Hossler <https://github.com/jmhossler>`_)
- Allow GitHub Enterprise users to specify a base URL, by passing in **base_url**
to the :meth:`gidgethub.abc.GitHubAPI` constructor.
Expand Down
36 changes: 13 additions & 23 deletions gidgethub/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,33 +182,23 @@ async def getiter(
iterable_key: Opt[str] = ITERABLE_KEY,
) -> AsyncGenerator[Any, None]:
"""Return an async iterable for all the items at a specified endpoint."""
data, more, _ = await self._make_request(
"GET",
url,
url_vars,
b"",
accept,
jwt=jwt,
oauth_token=oauth_token,
extra_headers=extra_headers,
)

if isinstance(data, dict) and iterable_key in data:
data = data[iterable_key]
for item in data:
yield item
if more:
# `yield from` is not supported in coroutines.
async for item in self.getiter(
more,
current_url: Opt[str] = url
while current_url:
data, current_url, _ = await self._make_request(
"GET",
current_url,
url_vars,
accept=accept,
b"",
accept,
jwt=jwt,
oauth_token=oauth_token,
iterable_key=iterable_key,
extra_headers=extra_headers,
):
yield item # pragma: nocover
)

if isinstance(data, dict) and iterable_key in data:
data = data[iterable_key]
for item in data:
yield item

async def post(
self,
Expand Down