🧑💻 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.
Release files for ghprofile 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ghprofile-0.2.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ghprofile-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / ghprofile-0.2.0.tar.gz
| Download URL | ghprofile-0.2.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebaa4738ebf009f1576f95a12275158ad46d5d26a01a137a7881348db9ab9c81
|
|
BLAKE2b-256 checksum How to use checksums |
36a677a14b030adfed95c53fbfba5fff61c1051f8b922703802279c1328a11b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.6
|
Release files / ghprofile-0.2.0-py3-none-any.whl
| Download URL | ghprofile-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
661d49b0e0d1326df3d9bf6abcb30287d1fbe37ff3b129b8a73d27eff2dec918
|
|
BLAKE2b-256 checksum How to use checksums |
75d85dd54e3dab238472abf6c57ea52a5c08d1bfffb59953c6d2bd192b78a07d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.6
|