Registry / http-networking / gidgethub

gidgethub

JSON →
library5.4.0pypypiunverified

Gidgethub is an asynchronous Python library for interacting with the GitHub API. It employs a sans-I/O approach, allowing users to integrate it with their preferred HTTP client library. The current version is 5.4.0 and it maintains an active release cadence, providing ongoing support and new features.

pip install gidgethub
INSTALL
IMPORT
SIG · GIDGETHUB
G
gidgethub
http-networkingpythonv5.4.0
Install
3.5s avg
Import
565ms
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.960 runs
installs and imports cleanly · install 0.0s · import 0.597s · 43.9MB
glibc
py 3.103.960 runs
installs and imports cleanly · install 3.5s · import 0.532s · 46MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GitHubAPI
from gidgethub import GitHubAPI
from gidgethub import GitHubAPI

This quickstart demonstrates how to make a simple API call to fetch user information using `gidgethub` with `aiohttp`. It requires a GitHub Personal Access Token set in the `GH_AUTH` environment variable for authentication.

import asyncio import os import aiohttp from gidgethub.aiohttp import GitHubAPI async def get_user_info(): # Replace 'YOUR_GH_USERNAME' with your GitHub username # Ensure GH_AUTH environment variable is set with a GitHub Personal Access Token # (e.g., export GH_AUTH='ghp_YOURTOKENHERE') username = 'YOUR_GH_USERNAME' oauth_token = os.environ.get('GH_AUTH', '') if not oauth_token: print("Error: GH_AUTH environment variable not set. Please set your GitHub Personal Access Token.") return async with aiohttp.ClientSession() as session: gh = GitHubAPI(session, username, oauth_token=oauth_token) try: # Fetch details for the authenticated user user_data = await gh.getitem(f'/users/{username}') print(f"User Login: {user_data['login']}") print(f"User Name: {user_data.get('name', 'N/A')}") print(f"Public Repos: {user_data['public_repos']}") print(f"Followers: {user_data['followers']}") except Exception as e: print(f"An error occurred: {e}") if __name__ == '__main__': # For Python 3.7+ asyncio.run(get_user_info())
Debug
Known issues
breakingGidgethub no longer supports Python 3.6 or 3.7. Users on these End-of-Life Python versions must upgrade to Python 3.8 or newer.
fix
Upgrade your Python environment to 3.8 or a later supported version.
affects: <5.4.0
breakingThe `machine-man-preview` header, previously used for GitHub App installation access tokens, was removed in `gidgethub` v5.0.1 as it is no longer required by GitHub's API.
fix
Remove any manual inclusion of `machine-man-preview` headers when obtaining installation access tokens; `gidgethub` will handle this automatically.
affects: >=5.0.1
gotchaSince v2.0, `gidgethub` no longer automatically sleeps when nearing the GitHub API rate limit. Instead, a `RateLimitExceeded` exception is raised when the rate limit is hit.
fix
Implement explicit error handling for `gidgethub.RateLimitExceeded` exceptions and incorporate your own rate-limiting or retry logic if necessary.
affects: >=2.0.0
gotchaFor webhook validation, `gidgethub` v5.1.0 and later utilize the `X-Hub-Signature-256` header when available for enhanced security. Ensure your GitHub webhook configuration uses SHA256.
fix
Configure your GitHub webhooks to use HMAC SHA256 for payload signatures. `gidgethub`'s webhook validation will automatically prefer this.
affects: >=5.1.0
gotchaThe execution order of callbacks registered with `gidgethub.routing.Router` became non-deterministic starting from v5.0.0. Do not rely on registration order for callback execution.
fix
Design your webhook handlers to be independent of execution order. If sequential processing is critical, manage it within a single, composite callback function.
affects: >=5.0.0
Upgrade
Version history
5.4.0latest on PyPI · released Jun 3, 2025
Audit
Dependencies
PyJWTrequiredRequired for GitHub App authentication (JWTs). Minimum version 2.4.0 since gidgethub v5.2.0.
aiohttpoptionalA popular asynchronous HTTP client library, commonly used with gidgethub via gidgethub.aiohttp.
httpxoptionalAnother asynchronous HTTP client library, supported via gidgethub.httpx.
tornadooptionalAsynchronous HTTP client support via gidgethub.tornado.
Agent activity
22 hits · last 30 days
node
20
Amazon
1
Resources
gidgethub — pip install gidgethub · libregistry