Open-CLI3
A CLI for every service which exposes a OpenAPI (Swagger) specification endpoint.
From the OpenAPI Specification project:
The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.
Demo
Docker
To start a CLI session run:
docker run -it privcloudcom/open-cli3 -s <swagger-spec-url>
e.g:
docker run -it privcloudcom/open-cli3 -s http://petstore.swagger.io/v3/swagger.json
CLI session
To start a CLI session run:
open-cli3 -s <swagger-spec-url>
e.g:
open-cli3 -s https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore-expanded.json
Running CLI session will automatically create config file at path ~/.open-cli3-config/config.cfg
To use profile config pass profile flag with desired profile name:
open-cli3 --profile <profile_name>
e.g.:
open-cli3 --profile profile1
This will work only if you specify profile in your open-cli3 config file: path ~/.open-cli3-config/config.cfg.
Example of config file:
[profile1]
endpoint = <endpoint>
access_token = <access_token>
To get data without running CLI session, please specify -c flag. It will automatically execute specified command
and return result data. Example:
open-cli3 -s <swagger-spec-url> -c 'auth:login --body.email=<user_email> --body.password=<user_password>'
or
open-cli3 --profile profile1 -c 'auth:login --body.email=<user_email> --body.password=<user_password>'
).
If a profile name (--profile flag) and swagger url (-s flag) are provided (example:
open-cli3 -s <swagger-spec-url> --profile profile1
), the profile will take precedence. If such profile does not exist CLI will automatically create config file for the profile.
If you want to measure the request and response total time you should use --print-request-time flag. Example:
open-cli3 -s <swagger-spec-url> --print-request-time true
For help run:
open-cli3 -h
Credits
This project relies on OpenApi3 openapi3 project & on Jonathan Slenders python-prompt-toolkit.
Metadata
Release files for open-cli3 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| open-cli3-0.0.0.tar.gz | 1.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| open_cli3-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / open-cli3-0.0.0.tar.gz
| Download URL | open-cli3-0.0.0.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d94581132d649f2c0da748754dac160769d274e8c4676cbd2f770edba29ba36
|
|
BLAKE2b-256 checksum How to use checksums |
a73a474162b5008ea866c402361e1274913b26d0915f379bb7ccb1d36c73efb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|
Release files / open_cli3-0.0.0-py3-none-any.whl
| Download URL | open_cli3-0.0.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c37a47fc3ee0114b5420a8e12a6b9414ad6d3f378115e598c0fb3367ef99fce
|
|
BLAKE2b-256 checksum How to use checksums |
50d0ac392bfb5928bac90390e580d87177b54280067b8e80ae1175fa6b8fba2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|