Skip to main content

A library for authenticating with GitHub across different operating systems

Project description

GitHub Authentication Library (githubauthlib)

PyPI version Python License: MIT TypeScript Version Quality Gate Status Coverage Security Rating Maintainability Rating Vulnerabilities Dependabot Status License: MIT Code style: black Downloads

A Python library for securely retrieving GitHub tokens from system keychains across different operating systems.

Features

  • Cross-platform support:
    • macOS: Uses Keychain Access
    • Windows: Uses Credential Manager
    • Linux: Uses libsecret
  • Secure token retrieval
  • Token validation
  • Comprehensive error handling
  • Logging support

Prerequisites

All Platforms

  • Python 3.6 or higher
  • Git (with credentials configured)

Linux-Specific

# Ubuntu/Debian
sudo apt-get install libsecret-tools

# Fedora
sudo dnf install libsecret

Installation

From PyPI

pip install githubauthlib

From Source

# Clone the repository
git clone https://github.com/GIALaboratory/cloud-platform-engineering.git

# Navigate to the library directory
cd cloud-platform-engineering/githubauthlib

# Install the package
pip install .

Usage

from githubauthlib import get_github_token, GitHubAuthError

try:
    token = get_github_token()
    if token:
        print("Token retrieved successfully!")
    else:
        print("No token found in system keychain")
except GitHubAuthError as e:
    print(f"Error retrieving token: {e}")

Verifying Installation

# Check installed version
pip list | grep githubauthlib

# View package details
pip show githubauthlib

Development Setup

For development, you may want to add the package directory to your PYTHONPATH. See AUXILIARY.md for detailed instructions.

Troubleshooting

  1. Token Not Found

    • Verify Git credentials are properly configured
    • Check system keychain for GitHub credentials
  2. Permission Issues

    • Ensure proper system keychain access
    • Verify Python has required permissions
  3. Linux Issues

    • Confirm libsecret-tools is installed
    • Check D-Bus session is running

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

githubauthlib-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

githubauthlib-1.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file githubauthlib-1.0.1.tar.gz.

File metadata

  • Download URL: githubauthlib-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for githubauthlib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8c8ff6e531da0ed6522398a2041c6f6731ceeba766acdca0e3442c4fe5a3c0c5
MD5 3b875f8c03b1d58f3151510fc6baf9c5
BLAKE2b-256 9471898e92e1e751a247891ce3d1be4cc6ce6713fe9416e14a2124d7a355e64a

See more details on using hashes here.

Provenance

The following attestation bundles were made for githubauthlib-1.0.1.tar.gz:

Publisher: workflow.yml on fleXRPL/githubauthlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file githubauthlib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: githubauthlib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for githubauthlib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef7cc29f5450ee7c61efecbd47cce211021954b8b81f8c7984c0680e35eb082b
MD5 771b4223adfbc91093e577966ecc2a90
BLAKE2b-256 8796af13f959eb6f68d3f370f5ce15f4b556699eb87a0e6f3e43da02e588edc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for githubauthlib-1.0.1-py3-none-any.whl:

Publisher: workflow.yml on fleXRPL/githubauthlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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