A command line utility to turn any OpenAPIv3 API into a Python CLI
Project description
OpenAPI CLI Generator
A powerful command-line utility that transforms OpenAPI v3.x specifications into intuitive Python CLIs. This tool allows you to interact with any OpenAPI-compliant API through a user-friendly command-line interface.
🚀 Features
- Automatic CLI Generation: Convert any OpenAPI v3.x spec into a fully functional command-line interface
- HTTP Method Support: Complete coverage of standard HTTP methods (GET, POST, PUT, DELETE)
- Alias Management: Easy management of multiple API endpoints through aliases
- Interactive Help: Built-in documentation and command help
- Request/Response Handling: Automatic handling of API interactions
- Parameter Validation: Type checking and validation for all inputs
📦 Installation
# Install from PyPI
pip install openapi-cli-generator
# Install from source
git clone https://github.com/yourusername/openapi-cli-generator.git
cd openapi-cli-generator
pip install -r requirements.txt
🔧 Requirements
- Python 3.7+
- Dependencies (automatically installed):
- PyYAML >= 6.0
- Requests >= 2.31.0
- OpenAPI Spec Validator >= 0.5.1
- Click >= 8.1.3
🚦 Quick Start
- Add an API alias:
openapi-cli-generator alias add petstore https://petstore3.swagger.io/api/v3/openapi.json
- Use the generated CLI:
# Show available commands
openapi-cli-generator petstore --help
# List available pets
openapi-cli-generator petstore pet list
# Get pet by ID
openapi-cli-generator petstore pet get --id 1
⚙️ Configuration
All runtime configuration, including API aliases, is stored locally in ~/.openapi_cli_generator/config.json. This ensures that:
- Your personal API configurations remain separate from the codebase
- Sensitive information is not accidentally committed to version control
- Each user maintains their own set of API aliases
📚 Documentation
- Project Description: Overview and key concepts
- Requirements: Functional and non-functional requirements
- Use Cases: Detailed use cases and scenarios
- Software Architecture: System design and components
- Testing Strategy: Testing approach and coverage
- Changelog: Version history and updates
🔍 Common Commands
Alias Management
# Add a new API alias
openapi-cli-generator alias add <url> <name>
# List all aliases
openapi-cli-generator alias list
# Remove an alias
openapi-cli-generator alias remove <name>
# Update existing alias
openapi-cli-generator alias update <name> <new-url>
# Show alias details
openapi-cli-generator alias show <name>
API Interaction
# Get general help
openapi-cli-generator --help
# Get help for specific API
openapi-cli-generator <alias> --help
# Get help for specific endpoint
openapi-cli-generator <alias> <endpoint> --help
🤝 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
Release history Release notifications | RSS feed
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 openapi_cli_generator-0.1.1.tar.gz.
File metadata
- Download URL: openapi_cli_generator-0.1.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40d1fbb967846ce2e1a58c30c00b391ec8a288768614778e5dd40a97938f4edb
|
|
| MD5 |
c05884a5881cf497fb8b200bd6a4dd5a
|
|
| BLAKE2b-256 |
56f4bde94a3dde94518656bdc54fadae97f0cf28ebc1a23fdcb6dd5fd48a2695
|
Provenance
The following attestation bundles were made for openapi_cli_generator-0.1.1.tar.gz:
Publisher:
python-publish.yml on nirabo/openapi-cli-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openapi_cli_generator-0.1.1.tar.gz -
Subject digest:
40d1fbb967846ce2e1a58c30c00b391ec8a288768614778e5dd40a97938f4edb - Sigstore transparency entry: 153951429
- Sigstore integration time:
-
Permalink:
nirabo/openapi-cli-generator@e863be7bef331b6ed49430a079ac04b386281b30 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/nirabo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e863be7bef331b6ed49430a079ac04b386281b30 -
Trigger Event:
release
-
Statement type:
File details
Details for the file openapi_cli_generator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: openapi_cli_generator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fabc5d49c57a34138ea2550bbe9946003109a977afe79ff2eae51190e97885a
|
|
| MD5 |
e9699153822eb5a34b8e82f5e666993c
|
|
| BLAKE2b-256 |
64496262bb4b6b3eca64bdc38cd2785e93bda356da407ac951303c9d68093adf
|
Provenance
The following attestation bundles were made for openapi_cli_generator-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on nirabo/openapi-cli-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openapi_cli_generator-0.1.1-py3-none-any.whl -
Subject digest:
3fabc5d49c57a34138ea2550bbe9946003109a977afe79ff2eae51190e97885a - Sigstore transparency entry: 153951430
- Sigstore integration time:
-
Permalink:
nirabo/openapi-cli-generator@e863be7bef331b6ed49430a079ac04b386281b30 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/nirabo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e863be7bef331b6ed49430a079ac04b386281b30 -
Trigger Event:
release
-
Statement type: