Skip to main content

Generate client based on OpenAPI Specification and wrap it in a command line interface

Project description

Open-CLI3

Build Status

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

Alt Text Alt Text Alt Text

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.

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

open-cli3-0.0.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_cli3-0.0.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file open-cli3-0.0.0.tar.gz.

File metadata

  • Download URL: open-cli3-0.0.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for open-cli3-0.0.0.tar.gz
Algorithm Hash digest
SHA256 5d94581132d649f2c0da748754dac160769d274e8c4676cbd2f770edba29ba36
MD5 1b33dc13b4fe84d7bea4e78a5be71574
BLAKE2b-256 a73a474162b5008ea866c402361e1274913b26d0915f379bb7ccb1d36c73efb1

See more details on using hashes here.

File details

Details for the file open_cli3-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: open_cli3-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for open_cli3-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c37a47fc3ee0114b5420a8e12a6b9414ad6d3f378115e598c0fb3367ef99fce
MD5 7d0f2ac6f50957c61ed07b68fb31babe
BLAKE2b-256 50d0ac392bfb5928bac90390e580d87177b54280067b8e80ae1175fa6b8fba2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page