Registry / http-networking / githubkit

githubkit

JSON →
library0.15.3pypypi✓ verified 35d 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.

http-networkingdevops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Main client for authenticated GitHub API access (tokens, personal access tokens).

from githubkit import GitHub

Client for GitHub App authentication.

from githubkit import AppGitHub

Function to parse GitHub webhook payloads and verify signatures.

from githubkit.webhooks import parse_webhook

Base exception for GitHub API errors.

from githubkit.exception import GitHubException

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 footguns
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.
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.
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.
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.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources