A lightweight library to fetch and summarize GitHub user data
Project description
🧑💻 ghprofile
A lightweight Python library to fetch and summarize a GitHub user's public profile and repository stats, including followers, bio, starred repos, and pinned repositories.
🚀 Features
- ✅ Get user bio, followers, and following count
- ✅ List all public repositories
- ✅ Count total stars across repositories
- ✅ Fetch pinned repositories (via scraping)
- ✅ Custom error handling for failed API calls
- ✅ Simple to use and extend
📦 Installation
pip install ghprofile
🔑 Authentication (Optional)
You can pass a GitHub personal access token to increase your rate limits and access private data.
✅ Token is optional
🕒 Without token: ~60 API calls/hour (public data only)
🔐 With token: ~5000 API calls/hour
🧑💻 Usage
With Token
from ghprofile.core import Ghprofile
gh = Ghprofile("octocat", "your_github_token")
print(gh.get_bio()) # → "A mysterious octocat."
print(gh.get_followers()) # → 5400
print(gh.get_repo()) # → ['hello-world', 'test-repo']
print(gh.get_stars()) # → 42
print(gh.get_pinned_repos())# → ['hello-world', 'octo-repo']
Without Token
from ghprofile.core import Ghprofile
gh = Ghprofile("octocat")
📁 Project Structure
ghprofile/
├── core.py # Main class Ghprofile
├── __init__.py
tests/
├── test_core.py # Unit tests using pytest
pyproject.toml # Build and tool config
README.md
📋 Error Handling
All exceptions are wrapped under a custom exception class:
from ghprofile.core import GhprofileError
try:
gh = Ghprofile("unknownuser", "badtoken")
except GhprofileError as e:
print("Something went wrong:", e)
🤝 Contributing
Contributions are welcome! If you’d like to:
Add new features (e.g. commit history, language breakdown) Improve error handling or test coverage Refactor or optimize the code Just fork the repo, create a new branch, and open a pull request. Don't forget to write or update tests for your changes.
License
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software with proper attribution.
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
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 ghprofile-0.2.0.tar.gz.
File metadata
- Download URL: ghprofile-0.2.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebaa4738ebf009f1576f95a12275158ad46d5d26a01a137a7881348db9ab9c81
|
|
| MD5 |
e809e2f2932ff518a0dc3be5d45c9040
|
|
| BLAKE2b-256 |
36a677a14b030adfed95c53fbfba5fff61c1051f8b922703802279c1328a11b2
|
File details
Details for the file ghprofile-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ghprofile-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
661d49b0e0d1326df3d9bf6abcb30287d1fbe37ff3b129b8a73d27eff2dec918
|
|
| MD5 |
31b49e99a1bacb22e153d8f4065edf70
|
|
| BLAKE2b-256 |
75d85dd54e3dab238472abf6c57ea52a5c08d1bfffb59953c6d2bd192b78a07d
|