CLI tool for OpenAPI specifications
Project description
clapikit
CLI tool for OpenAPI specifications.
Description
clapikit (CLI + API + Kit) is a command-line tool that parses OpenAPI YAML/JSON files and provides a CLI interface to interact with APIs defined in those specifications. It dynamically generates subcommands based on the endpoints defined in the OpenAPI specification.
Installation
# Install with uvx
uvx clapikit
# Or install with pip
pip install clapikit
Usage
# List available commands from an OpenAPI specification
clapikit --spec https://example.com/openapi.yaml
# Execute an API endpoint
clapikit --spec https://example.com/openapi.yaml getUserInfo
# Override server URL
clapikit --spec https://example.com/openapi.yaml --server http://custom-server:8080 getUserInfo
# Enable debug output
clapikit --spec https://example.com/openapi.yaml --debug getUserInfo
# Send data with a request
clapikit --spec https://example.com/openapi.yaml createUser --data '{"name": "John", "email": "john@example.com"}'
# Specify query parameters
clapikit --spec https://example.com/openapi.yaml searchUsers --params '{"role": "admin", "limit": 10}'
# Set custom headers
clapikit --spec https://example.com/openapi.yaml getUserInfo --headers '{"Authorization": "Bearer token123"}'
# Control output format
clapikit --spec https://example.com/openapi.yaml getUserInfo --output text
Features
- Parse OpenAPI YAML/JSON files from local paths or URLs
- Dynamically generate subcommands based on API endpoints
- Execute API requests directly from the command line
- Override server URL from command line
- Debug mode for detailed logging
- Support for request data, query parameters, and headers
- JSON and text output formats
Development
# Clone the repository
git clone https://github.com/youyo/clapikit.git
cd clapikit
# Install development dependencies
uv pip install -e .
# Run tests
python test_cli.py
Mock Server for Testing
You can use Prism to run a mock server for testing:
npx @stoplight/prism-cli mock https://learn.openapis.org/examples/v3.0/api-with-examples.yaml
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 clapikit-0.1.0.tar.gz.
File metadata
- Download URL: clapikit-0.1.0.tar.gz
- Upload date:
- Size: 44.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96cead7435b17d1dac1e01f9ea2d37643f3f2773e6a1ae140ef690628125c6e3
|
|
| MD5 |
01faa76fbe40d504e5dd70a356717614
|
|
| BLAKE2b-256 |
c58b2751c35507e0999076b121073e7b0c8e097eede406cf505e7740e02a74a6
|
Provenance
The following attestation bundles were made for clapikit-0.1.0.tar.gz:
Publisher:
publish.yaml on youyo/clapikit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clapikit-0.1.0.tar.gz -
Subject digest:
96cead7435b17d1dac1e01f9ea2d37643f3f2773e6a1ae140ef690628125c6e3 - Sigstore transparency entry: 203726125
- Sigstore integration time:
-
Permalink:
youyo/clapikit@685abdf20eff99cf79e96ac920c39e11b010043c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/youyo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@685abdf20eff99cf79e96ac920c39e11b010043c -
Trigger Event:
push
-
Statement type:
File details
Details for the file clapikit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: clapikit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a162f097fbf9d62d14ec93db6a7eb7bb21afa3da05f6210e1d36088152fa6e81
|
|
| MD5 |
f7f0a838ee7dddbb7ce48a8b5e7ba78e
|
|
| BLAKE2b-256 |
560a2a9307505954a78648fcc548fa59a0fbaa8b4ab476b34c0888bfda38dfc4
|
Provenance
The following attestation bundles were made for clapikit-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on youyo/clapikit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clapikit-0.1.0-py3-none-any.whl -
Subject digest:
a162f097fbf9d62d14ec93db6a7eb7bb21afa3da05f6210e1d36088152fa6e81 - Sigstore transparency entry: 203726130
- Sigstore integration time:
-
Permalink:
youyo/clapikit@685abdf20eff99cf79e96ac920c39e11b010043c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/youyo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@685abdf20eff99cf79e96ac920c39e11b010043c -
Trigger Event:
push
-
Statement type: