Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit df4d7d8

Browse files
committed
IDP-43-modular: update readme
1 parent 4aeaa5d commit df4d7d8

File tree

4 files changed

+48
-29
lines changed

4 files changed

+48
-29
lines changed

cpk_lib_python_github/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,33 @@ The tool automatically creates log files:
415415
- **Content**: All operations, errors, and debug information
416416
- **Rotation**: Append mode (consider rotating large files)
417417

418+
## 🐍 Python usage
419+
If you prefer to use this tool as a Python library in your scripts, you can import and use it directly:
420+
421+
### Quick Token Generation
422+
423+
424+
python3 -c "from cpk_lib_python_github import GitHubAPIClient, TokenManager, OutputFormatter, Config
425+
426+
# Configure your GitHub App
427+
config = Config(
428+
app_id='YOUR_APP_ID',
429+
private_key_path='YOUR_PATH/bot.pem',
430+
timeout=60,
431+
debug=False
432+
)
433+
434+
# Initialize components
435+
api_client = GitHubAPIClient(timeout=60)
436+
formatter = OutputFormatter(use_colors=False)
437+
token_manager = TokenManager(api_client, formatter)
438+
439+
print('🔑 Testing generate_org_token for YOUR_ORG_NAME...')
440+
# Generate token for organization
441+
token_manager.generate_org_token(config, 'YOUR_ORG_NAME')
442+
print('✅ README example completed successfully!')
443+
"
444+
418445
## 📄 License
419446

420447
This project is licensed under the GPLv3 License.

cpk_lib_python_github/__init__.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# -*- coding: utf-8 -*-
2-
"""GitHub App token generator package."""
2+
"""CPK Lib Python GitHub - GitHub App Token Generator Package."""
3+
34
from .github_app_token_generator_package.github_app_token_generator import (
4-
auth,
5-
formatters,
6-
github_api,
75
token_manager,
86
)
7+
from .github_app_token_generator_package.github_app_token_generator.config import (
8+
Config,
9+
)
10+
from .github_app_token_generator_package.github_app_token_generator.formatters import (
11+
OutputFormatter,
12+
)
13+
from .github_app_token_generator_package.github_app_token_generator.github_api import (
14+
GitHubAPIClient,
15+
)
916

10-
# Import the classes from modules
11-
GitHubAppAuth = auth.GitHubAppAuth
12-
OutputFormatter = formatters.OutputFormatter
13-
GitHubAPIClient = github_api.GitHubAPIClient
1417
TokenManager = token_manager.TokenManager
1518

16-
__all__ = [
17-
"GitHubAppAuth",
18-
"GitHubAPIClient",
19-
"TokenManager",
20-
"OutputFormatter",
21-
]
19+
__all__ = ["GitHubAPIClient", "TokenManager", "OutputFormatter", "Config"]
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# -*- coding: utf-8 -*-
2-
"""GitHub App token generator package."""
3-
__all__ = []
2+
"""GitHub App Token Generator Package."""
3+
4+
from .github_app_token_generator import *
5+
6+
__all__ = ["github_app_token_generator"]
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
# -*- coding: utf-8 -*-
2-
"""GitHub App token generator module."""
3-
from .auth import GitHubAppAuth
4-
from .config import Config, get_config_from_env
2+
"""GitHub App Token Generator - Core Module."""
3+
4+
from .config import Config
55
from .formatters import OutputFormatter
66
from .github_api import GitHubAPIClient
7-
from .main import main
87
from .token_manager import TokenManager
98

10-
__all__ = [
11-
"main",
12-
"GitHubAppAuth",
13-
"GitHubAPIClient",
14-
"TokenManager",
15-
"OutputFormatter",
16-
"Config",
17-
"get_config_from_env",
18-
]
9+
__all__ = ["GitHubAPIClient", "TokenManager", "OutputFormatter", "Config"]

0 commit comments

Comments
 (0)