Registry / http-networking / githubkit

githubkit

JSON →
library0.16.1pypypi✓ verified 28d ago

GitHubKit is a comprehensive, type-hinted SDK for interacting with the GitHub REST API and GraphQL API, and for parsing webhooks. It supports the latest GitHub API versions and provides a consistent interface for various GitHub features. The current version is 0.15.3, with frequent releases often driven by updates to GitHub's OpenAPI specification.

pip install githubkit
INSTALL
IMPORT
SIG · GITHUBKIT
G
githubkit
http-networkingpythonv0.16.1
Install
9.0s avg
Import
767ms
Disk
109MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.16.1 · 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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.800s · 81.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 9.0s · import 0.734s · 82MB
109MB installed
● package 109MB
Code
Verified usage

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

GitHub
✓ from githubkit import GitHub
Main client for authenticated GitHub API access (tokens, personal access tokens).
AppGitHub
✓ from githubkit import AppGitHub
Client for GitHub App authentication.
parse_webhook
✓ from githubkit.webhooks import parse_webhook
Function to parse GitHub webhook payloads and verify signatures.
GitHubException
✓ from githubkit.exception import GitHubException
Base exception for GitHub API errors.

This quickstart demonstrates how to initialize the GitHubKit client with a Personal Access Token (PAT) and make a simple REST API call to fetch the authenticated user's details and their repositories. Ensure `GITHUB_TOKEN` is set in your environment.

import os from githubkit import GitHub github_token = os.environ.get('GITHUB_TOKEN', '') if not github_token: print("Error: GITHUB_TOKEN environment variable not set.") else: github = GitHub(github_token) try: # Get information about the authenticated user user = github.rest.users.get_authenticated_user() print(f"Hello, {user.data.login} (ID: {user.data.id})!") # Example: list repositories for the authenticated user repos = github.rest.repos.list_for_authenticated_user() print(f"You have {len(repos.data)} repositories.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingIn `v0.15.0`, the default GitHub REST API version was updated to `2026-03-10`. This might introduce breaking changes to existing code if your application relied on older API behaviors or response structures for endpoints that changed in the new API version. Review GitHub's API changelog for this version.
fix
Review your API calls and ensure compatibility with GitHub REST API version 2026-03-10. If necessary, you can explicitly set an older API version when initializing the client, e.g., `GitHub(token, api_version='2022-11-28')`.
affects: >=0.15.0
gotchaIt is highly recommended to reuse `GitHub` or `AppGitHub` client instances rather than creating a new one for each request. Creating multiple clients can lead to performance issues due to re-establishing connections and not utilizing connection pooling efficiently.
fix
Initialize your `GitHub` client once at the application startup or within a global scope (e.g., as a global variable, dependency injection, or FastAPI `Depends`) and pass the same instance to all functions or methods that need to interact with the GitHub API.
affects: All versions
gotchaWhen handling GitHub webhooks, failing to verify the `X-Hub-Signature-256` header (or `X-GitHub-Signature`) can lead to security vulnerabilities, allowing attackers to send forged payloads to your endpoint.
fix
Always use `githubkit.webhooks.parse_webhook(payload, signature, secret)` and ensure you pass the correct webhook secret configured in your GitHub App or repository settings. The `parse_webhook` function handles the signature verification automatically and raises an error if it fails.
affects: All versions
gotchaGitHub API requests are subject to rate limiting. Not handling `githubkit.exception.RateLimitError` or checking `response.headers['x-ratelimit-remaining']` can lead to your application being temporarily blocked.
fix
Implement robust error handling for `githubkit.exception.RateLimitError`. Consider using a retry mechanism with exponential backoff, or consult the `x-ratelimit-reset` header to know when the rate limit will reset and pause requests accordingly.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'githubkit'
The `githubkit` library is not installed in the active Python environment, or there is a typo in the import statement.
fix
Install `githubkit` using pip: `pip install githubkit` or poetry: `poetry add githubkit`, and verify the import statement is `from githubkit import GitHub`.
githubkit.exception.RequestError: Client Error: 401 Unauthorized for url: https://api.github.com/...
The GitHub API request failed due to incorrect or missing authentication credentials, such as an invalid Personal Access Token (PAT), an expired token, or insufficient scopes.
fix
Ensure you are using a valid GitHub Personal Access Token (PAT) with the necessary scopes, or correctly configure another authentication strategy (e.g., GitHub App) as described in the `githubkit` documentation.
AttributeError: 'FullRepository' object has no attribute 'old_field_name'
The GitHub API schema has undergone changes, and `githubkit` has been updated, leading to breaking changes in the structure of model objects (e.g., `FullRepository`).
fix
Update your code to reflect the new model structure by consulting the latest `githubkit` documentation, changelog, or the official GitHub API documentation for the specific endpoint you are using.
ValueError: X-Hub-Signature-256 mismatch
The calculated HMAC signature of the webhook payload does not match the `X-Hub-Signature-256` header provided by GitHub, indicating either a wrong secret, a modified payload, or an incorrect signing process.
fix
Verify that the webhook secret configured in GitHub matches the secret used in `githubkit.webhooks.verify()`, and ensure the raw request body and headers are passed to the verification function without any modifications.
pydantic.ValidationError: 1 validation error for WebhookWorkflowJobQueued / workflow_job field `steps` field required (type=value_error.missing)
A webhook payload or API response failed Pydantic validation, often due to an unexpected or missing field in the data structure, potentially related to a mismatch in Pydantic versions or an outdated event schema.
fix
Ensure you are using Pydantic v2 (recommended by `githubkit`) and review the specific `ValidationError` message to identify the missing or malformed field. Update your code to handle the expected schema or ensure the incoming payload conforms to the expected structure.
Upgrade
Version history
0.16.1latest on PyPI · released Aug 14, 2026
Audit
Dependencies
httpxrequiredUsed for HTTP requests, provides async capabilities.
pydanticrequiredUsed for data model serialization/deserialization and validation (Pydantic v2 required).
Agent activity
20 hits · last 30 days
node
16
Resources
githubkit — pip install githubkit · libregistry