PyGithub

2.6.0 · active · verified Tue Mar 17

Python library to access the GitHub REST API v3. Provides typed Python objects for repositories, issues, pull requests, users, organizations, and more. Built on top of requests. Current version is 2.6.0 (2025). Supports Python 3.8+.

Warnings

Install

Imports

Quickstart

Minimal example: authenticate with a personal access token and list repository info and issues.

import os
from github import Github, Auth

token = os.environ.get('GITHUB_TOKEN', '')
auth = Auth.Token(token)
g = Github(auth=auth)

repo = g.get_repo('PyGithub/PyGithub')
print(f'Repo: {repo.full_name}')
print(f'Stars: {repo.stargazers_count}')

# List open issues
for issue in repo.get_issues(state='open')[:5]:
    print(f'  #{issue.number}: {issue.title}')

g.close()

view raw JSON →