A library for authenticating with GitHub across different operating systems
Project description
GitHub Authentication Library (githubauthlib)
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
-
Token Not Found
- Verify Git credentials are properly configured
- Check system keychain for GitHub credentials
-
Permission Issues
- Ensure proper system keychain access
- Verify Python has required permissions
-
Linux Issues
- Confirm libsecret-tools is installed
- Check D-Bus session is running
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c8ff6e531da0ed6522398a2041c6f6731ceeba766acdca0e3442c4fe5a3c0c5
|
|
| MD5 |
3b875f8c03b1d58f3151510fc6baf9c5
|
|
| BLAKE2b-256 |
9471898e92e1e751a247891ce3d1be4cc6ce6713fe9416e14a2124d7a355e64a
|
Provenance
The following attestation bundles were made for githubauthlib-1.0.1.tar.gz:
Publisher:
workflow.yml on fleXRPL/githubauthlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
githubauthlib-1.0.1.tar.gz -
Subject digest:
8c8ff6e531da0ed6522398a2041c6f6731ceeba766acdca0e3442c4fe5a3c0c5 - Sigstore transparency entry: 166495307
- Sigstore integration time:
-
Permalink:
fleXRPL/githubauthlib@92c68fbd4c0d2bc7d006848d402d283262f6cd97 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/fleXRPL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@92c68fbd4c0d2bc7d006848d402d283262f6cd97 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef7cc29f5450ee7c61efecbd47cce211021954b8b81f8c7984c0680e35eb082b
|
|
| MD5 |
771b4223adfbc91093e577966ecc2a90
|
|
| BLAKE2b-256 |
8796af13f959eb6f68d3f370f5ce15f4b556699eb87a0e6f3e43da02e588edc3
|
Provenance
The following attestation bundles were made for githubauthlib-1.0.1-py3-none-any.whl:
Publisher:
workflow.yml on fleXRPL/githubauthlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
githubauthlib-1.0.1-py3-none-any.whl -
Subject digest:
ef7cc29f5450ee7c61efecbd47cce211021954b8b81f8c7984c0680e35eb082b - Sigstore transparency entry: 166495309
- Sigstore integration time:
-
Permalink:
fleXRPL/githubauthlib@92c68fbd4c0d2bc7d006848d402d283262f6cd97 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/fleXRPL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@92c68fbd4c0d2bc7d006848d402d283262f6cd97 -
Trigger Event:
push
-
Statement type: