Skip to main content

GitHub API Wrapper

PyPI version Python Versions License: MIT

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

Release files for github-rest-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for github-rest-sdk 0.1.2
File Size Uploaded
github_rest_sdk-0.1.2.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for github-rest-sdk 0.1.2
File Interpreter ABI Platform
github_rest_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / github_rest_sdk-0.1.2.tar.gz

Download URL github_rest_sdk-0.1.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
62d75ca60c7cc1e32256c18d08b0964172852240a099007969625f9aebd9cc8a
BLAKE2b-256 checksum
How to use checksums
08e102e76e14f68ba9abc46194bcfdf148869d6ecb94f016b6bb1dbdfacd113c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / github_rest_sdk-0.1.2-py3-none-any.whl

Download URL github_rest_sdk-0.1.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1da582f90246091413dc88d4a7f910b593abaa8057a03fc5f2cf3ddacdcad775
BLAKE2b-256 checksum
How to use checksums
ad239566ab38bba083731bd4fd088fc4d168431bb90a0186256b34fd61777616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page