GitHub API Wrapper
A lightweight, type-safe Python SDK for interacting with the GitHub REST API. Built with httpx, Pydantic, and Tenacity, it provides a clean interface with automatic retries, pagination, and custom exception handling.
Installation
pip install github-api-wrapper-py
Features
- Type-safe Pydantic models
- GitHub User API
- Repository API
- Repository search
- Automatic pagination
- Custom exceptions
- Built on httpx
Installation
pip install github-rest-sdk
Quick Start
from github_api import GitHubClient
client = GitHubClient("YOUR_GITHUB_TOKEN")
user = client.get_user("torvalds")
print(user.login)
print(user.followers)
Retrieve repository information:
repo = client.get_repo("openai", "openai-python")
print(repo.name)
print(repo.stars)
print(repo.forks)
Search repositories:
results = client.search_repositories("machine learning")
print(results.total_count)
for repo in results.items[:5]:
print(repo.name)
API Reference
Users
client.get_user(username)
client.list_user_repos(username)
client.list_all_user_repos(username)
Repositories
client.get_repo(owner, repo)
client.search_repositories(query)
Project Structure
github-api-wrapper/
│
├── github_api/
│ ├── client.py
│ ├── models.py
│ ├── exceptions.py
│ └── __init__.py
│
├── examples/
├── tests/
├── README.md
├── pyproject.toml
└── LICENSE
Why This Project?
This project was built to understand how production-quality Python SDKs are designed.
It demonstrates:
- HTTP client abstraction
- Type-safe models using Pydantic
- Automatic retry handling with Tenacity
- Pagination helpers
- Custom exception hierarchy
- Python packaging using
pyproject.toml - Publishing packages to PyPI
Roadmap
- Async client
- Additional GitHub REST API endpoints
- GitHub Actions CI
- Improved test coverage
- OAuth authentication support
License
This project is licensed under the MIT License.
Contributing
Contributions, suggestions, and bug reports are welcome. Feel free to open an issue or submit a pull request.
Links
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 github_rest_sdk-0.1.2.tar.gz.
File metadata
- Download URL: github_rest_sdk-0.1.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62d75ca60c7cc1e32256c18d08b0964172852240a099007969625f9aebd9cc8a
|
|
| MD5 |
9e16b1635779ad0ba09e25b7b21a2856
|
|
| BLAKE2b-256 |
08e102e76e14f68ba9abc46194bcfdf148869d6ecb94f016b6bb1dbdfacd113c
|
File details
Details for the file github_rest_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: github_rest_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1da582f90246091413dc88d4a7f910b593abaa8057a03fc5f2cf3ddacdcad775
|
|
| MD5 |
4421706d40dddc39032136de6c62397c
|
|
| BLAKE2b-256 |
ad239566ab38bba083731bd4fd088fc4d168431bb90a0186256b34fd61777616
|