{"id":7262,"library":"githubpy","title":"githubpy: Simple GitHub REST API Client","description":"githubpy is a straightforward Python3 client designed to interact with the GitHub REST API. Its current version is 2.0.0, released in May 2023. Despite the recent PyPI release, the underlying GitHub repository shows no active development since 2017, indicating it is likely unmaintained.","status":"abandoned","version":"2.0.0","language":"en","source_language":"en","source_url":"https://github.com/michaelliao/githubpy","tags":["GitHub API","REST API","SDK","client","unmaintained"],"install":[{"cmd":"pip install githubpy","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"HTTP client for making API requests.","package":"requests"},{"reason":"Used for JWT (JSON Web Token) operations, potentially for GitHub App authentication.","package":"python-jose"}],"imports":[{"note":"Commonly confused with the 'PyGithub' library, which uses 'from github import Github'.","wrong":"from github import Github","symbol":"Github","correct":"from githubpy.github import Github"}],"quickstart":{"code":"import os\nfrom githubpy.github import Github\n\n# It's recommended to use an environment variable for your token\ngithub_token = os.environ.get('GITHUB_TOKEN', 'YOUR_GITHUB_TOKEN')\n\nif not github_token or github_token == 'YOUR_GITHUB_TOKEN':\n    print(\"WARNING: GITHUB_TOKEN environment variable not set or placeholder used. This may lead to rate limiting or authentication errors.\")\n\ntry:\n    g = Github(github_token)\n    \n    # Get authenticated user information\n    user_response = g.get('/user')\n    user_response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)\n    user_data = user_response.json()\n    print(f\"Authenticated as: {user_data.get('login')}\")\n\n    # List repositories for the authenticated user\n    repos_response = g.get('/user/repos')\n    repos_response.raise_for_status()\n    repos_data = repos_response.json()\n    print(\"\\nUser Repositories:\")\n    for repo in repos_data[:3]: # Print first 3 repos for brevity\n        print(f\"- {repo.get('name')}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    if hasattr(e, 'response') and e.response is not None:\n        print(f\"Response Status: {e.response.status_code}\")\n        print(f\"Response Body: {e.response.text}\")\n","lang":"python","description":"Initializes the GitHub client with a personal access token and retrieves information about the authenticated user and their repositories. Authentication is crucial for most API interactions to avoid severe rate limits."},"warnings":[{"fix":"Verify your `pip install` command and `from ... import ...` statements. If you intend to use the widely supported library, install `PyGithub` (`pip install PyGithub`) and use `from github import Github`.","message":"This library (`githubpy`) is frequently confused with the more popular and actively maintained `PyGithub` library. They have different import paths and API structures. Ensure you are using the correct library for your project.","severity":"gotcha","affected_versions":"All"},{"fix":"Be aware that new features, bug fixes, or compatibility updates for the latest GitHub API changes are unlikely. Consider using an actively maintained alternative like `PyGithub` for production systems.","message":"Despite a PyPI release (v2.0.0) in May 2023, the official GitHub repository for `githubpy` (michaelliao/githubpy) has not been updated since August 2017. This suggests the project is effectively abandoned, and the 2.0.0 release might be a re-packaging without active code development or bug fixes.","severity":"breaking","affected_versions":"2.0.0"},{"fix":"Generate a GitHub Personal Access Token with appropriate scopes (e.g., 'repo', 'read:user'). Pass this token during `Github` client initialization: `g = Github('your_token')`. Store tokens securely, preferably as environment variables, not hardcoded.","message":"Unauthenticated requests to the GitHub API are heavily rate-limited (e.g., 60 requests per hour). Most practical uses require authentication via a Personal Access Token or GitHub App.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"If you intend to use `githubpy`, change your import statement to `from githubpy.github import Github`. If you meant to use the `PyGithub` library, install it with `pip install PyGithub` and use `from github import Github`.","cause":"Attempting to import `Github` from the `github` package, which belongs to the `PyGithub` library, while having `githubpy` installed.","error":"ImportError: cannot import name 'Github' from 'github'"},{"fix":"Ensure your GitHub Personal Access Token is valid and has the necessary scopes (e.g., `repo` for repository operations, `read:user` for user profiles). Pass the token correctly during client initialization: `g = Github('YOUR_TOKEN')`. Avoid hardcoding tokens; use environment variables instead.","cause":"The GitHub API returned a 403 Forbidden status, usually due to incorrect, missing, or insufficient permissions on the provided Personal Access Token, or hitting unauthenticated rate limits.","error":"requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/user/repos"},{"fix":"The `githubpy` client's `.get()` method returns a `requests.Response` object. You need to call `.json()` on this response to get the Python dictionary: `data = response.json()`. Access attributes on the dictionary directly, e.g., `data['login']`.","cause":"Attempting to call `.json()` on an object that is already a dictionary, or trying to access attributes on a raw response before parsing it.","error":"AttributeError: 'dict' object has no attribute 'json'"}]}