A Python library to interact with the GitHub API
Project description
GitHub API Client
GitHub API Client is a Python library for interacting with the GitHub API. It simplifies the process of fetching data about repositories, commits, contributors, pull requests, and README content.
Features
- Fetch repository information
- Fetch commits by the repository owner
- Fetch contributors to a repository
- Fetch open pull requests
- Fetch and decode the README file content
- Process commit data to check if commits were made today
- Fetch repositories of a specific user
Installation
pip install githubapiclient
Usage
Example Code
from githubapiclient import GitHubAPIClient
import json
if __name__ == "__main__":
# Replace with your GitHub token and repository owner
token = "your_personal_access_token"
repo_owner = "repository_owner"
client = GitHubAPIClient(token, repo_owner)
# Example: Get commit data for a specific repository
repo_name = "your_repository_name"
result = client.fetch_repo_info(repo_name)
print(json.dumps(result, indent=4))
Available Methods
fetch_repo_info(repo_name)- Fetch details of a specific repository.fetch_commits(repo_name)- Fetch commits by the repository owner.fetch_contributors(repo_name)- Fetch contributors to a repository.fetch_pull_requests(repo_name)- Fetch open pull requests.fetch_readme(repo_name)- Fetch and decode the README file content.fetch_user_repos()- Fetch all repositories of the user.process_commits(commits)- Process commit data for today's commits.load_commit_data(repo_name)- Load and process all repository data.
Configuration
- Replace the placeholder values for
tokenandrepo_ownerin your script with actual values. - You can generate a personal access token from GitHub under Developer Settings.
Requirements
- Python 3.6+
requestslibrary
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
githubapiclient-0.2.0.tar.gz
(3.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file githubapiclient-0.2.0.tar.gz.
File metadata
- Download URL: githubapiclient-0.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8fa35673b1d067942a7dcbe8604e5c6d0e5cd515e885a12d1d0b2baf9ce6eb6
|
|
| MD5 |
ac40aeac5c739212189d5f09a93f7d55
|
|
| BLAKE2b-256 |
32a0aea957b7e1c10091dca82cf093073a384754bee59d057d391645f856a8e0
|
File details
Details for the file githubapiclient-0.2.0-py3-none-any.whl.
File metadata
- Download URL: githubapiclient-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb1266f63a073254698009e12a43640f22674bc390008001d2111653373e02d
|
|
| MD5 |
70812b230862f657a13b8fc5f5c7d4a7
|
|
| BLAKE2b-256 |
33ea236e106461957d83be5f5fc8f66c76b26a81a277eb094f23a336a36d121a
|