Skip to main content

Modules for interacting with GitHub API.

Project description

The best way to interact with GitHub API.

Note: This module is useful for the GitHub API
Your URL should look like this https://api.github.com This is working module with your PAT Token

Prerequisites

from github_module import GitHubHelper

Getting Started

Connectivity to GitHub

To initialize a connection to GitHub, instantiate the GitHubHelper class with your GitHub URL, ORG, and Personal API Token:

github_helper = GitHubHelper(GITHUB_API, API_TOKEN)


1. Check existing remaining API calls

  • Fetch existing remaining API calls
from github_module import GitHubHelper

github_api = "https://api.github.com"
access_token = "<your_token>"
github_helper = GitHubHelper(github_api, access_token)

rate_limit_remaining = github_helper.get_rate_limit()

if rate_limit_remaining is not False:
    print(f"Remaining GitHub API rate limit: {rate_limit_remaining}")
else:
    print("Failed to fetch the rate limit.")

2. Check if repository exist with error if not

  • Check if repository exist with access otherwise collects the error
from github_module import GitHubHelper

github_api = "https://api.github.com"
access_token = "<your_token>"
github_helper = GitHubHelper(github_api, access_token)

owner = "octocat"
repo = "Hello-World"
repo_status = github_helper.check_repository(owner, repo)

print(f"Status: {repo_status['status']}")
print(f"Message: {repo_status['message']}")


Data Privacy Note

🔒 We respect your privacy: This module does not store any of your data anywhere. It simply interacts with the GitHub API to perform the requested operations. Ensure you manage your connection details securely.

Release Notes

Latest Release: 0.1 (05 Aug 2024)

  • Get your current rate limit
    • Use the function get_rate_limit to check your existing remaining rate limit for your token
    • Imp Note: Your rate limit is associated with your account. Not with per PAT Token

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

github_module-0.2.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

github_module-0.2-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page