{"id":4022,"library":"githubkit","title":"GitHubKit: GitHub SDK for Python","description":"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.","status":"active","version":"0.15.3","language":"python","source_language":"en","source_url":"https://github.com/yanyongyu/githubkit","tags":["github","sdk","api","rest","graphql","webhook","async"],"install":[{"cmd":"pip install githubkit","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for HTTP requests, provides async capabilities.","package":"httpx","optional":false},{"reason":"Used for data model serialization/deserialization and validation (Pydantic v2 required).","package":"pydantic","optional":false}],"imports":[{"note":"Main client for authenticated GitHub API access (tokens, personal access tokens).","symbol":"GitHub","correct":"from githubkit import GitHub"},{"note":"Client for GitHub App authentication.","symbol":"AppGitHub","correct":"from githubkit import AppGitHub"},{"note":"Function to parse GitHub webhook payloads and verify signatures.","symbol":"parse_webhook","correct":"from githubkit.webhooks import parse_webhook"},{"note":"Base exception for GitHub API errors.","symbol":"GitHubException","correct":"from githubkit.exception import GitHubException"}],"quickstart":{"code":"import os\nfrom githubkit import GitHub\n\ngithub_token = os.environ.get('GITHUB_TOKEN', '')\n\nif not github_token:\n    print(\"Error: GITHUB_TOKEN environment variable not set.\")\nelse:\n    github = GitHub(github_token)\n    try:\n        # Get information about the authenticated user\n        user = github.rest.users.get_authenticated_user()\n        print(f\"Hello, {user.data.login} (ID: {user.data.id})!\")\n\n        # Example: list repositories for the authenticated user\n        repos = github.rest.repos.list_for_authenticated_user()\n        print(f\"You have {len(repos.data)} repositories.\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"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')`.","message":"In `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.","severity":"breaking","affected_versions":">=0.15.0"},{"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.","message":"It 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"GitHub 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.15.3':48 'api':20,23,33,63 'async':67 'comprehens':9 'consist':38 'current':45 'driven':53 'featur':43 'frequent':50 'github':2,18,32,42,57,61 'githubkit':1,6 'graphql':22,65 'hint':12 'interact':15 'interfac':39 'latest':31 'often':52 'openapi':59 'pars':26 'provid':36 'python':5 'releas':51 'rest':19,64 'sdk':3,13,62 'specif':60 'support':29 'type':11 'type-hint':10 'updat':55 'various':41 'version':34,46 'webhook':27,66","created_at":"2026-04-12T03:37:39.891673+00:00","updated_at":"2026-04-16T15:17:06.684727+00:00","problems":[{"fix":"Install `githubkit` using pip: `pip install githubkit` or poetry: `poetry add githubkit`, and verify the import statement is `from githubkit import GitHub`.","cause":"The `githubkit` library is not installed in the active Python environment, or there is a typo in the import statement.","error":"ModuleNotFoundError: No module named 'githubkit'"},{"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.","cause":"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.","error":"githubkit.exception.RequestError: Client Error: 401 Unauthorized for url: https://api.github.com/..."},{"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.","cause":"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`).","error":"AttributeError: 'FullRepository' object has no attribute 'old_field_name'"},{"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.","cause":"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.","error":"ValueError: X-Hub-Signature-256 mismatch"},{"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.","cause":"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.","error":"pydantic.ValidationError: 1 validation error for WebhookWorkflowJobQueued / workflow_job\n  field `steps`\n    field required (type=value_error.missing)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.16.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/yanyongyu/githubkit","docs":"https://github.com/yanyongyu/githubkit","changelog":null,"pypi":"https://pypi.org/project/githubkit/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}