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.1.0.tar.gz
(3.6 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.1.0.tar.gz.
File metadata
- Download URL: githubapiclient-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
297df8862cf7a4ee23a1093c8cb755439daf58835f54205e8b6f94f41d29474a
|
|
| MD5 |
e1c5def60faaaad8e3b83b0e60a3079b
|
|
| BLAKE2b-256 |
636d50a41b7c0cc17de4d2c0c0aa20487b306f8fb355ba4af1fe82a41a3e8bba
|
File details
Details for the file githubapiclient-0.1.0-py3-none-any.whl.
File metadata
- Download URL: githubapiclient-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 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 |
3f7aceed4f7e5b44f78d7a79f4282ae1c98784754df7fc3e2b012af4e4010e3a
|
|
| MD5 |
db47a37c89795861d80ef18a67c53df5
|
|
| BLAKE2b-256 |
0f7a5e49c6175c157196c9ac2a634bc3dc9110605a26a3e09583976d28ed26ee
|