Skip to main content

Handy REST API client on your terminal

Project description

RESTEasyCLI

Handy REST API client on your terminal

PyPI version Build Status

Installation

pip install RESTEasyCLI

# OR

pipenv install RESTEasyCLI

Usage

Help menu

recli help
usage: recli [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]

Handy REST API client on your terminal

optional arguments:
  --version            show program's version number and exit
  -v, --verbose        Increase verbosity of output. Can be repeated.
  -q, --quiet          Suppress output except warnings and errors.
  --log-file LOG_FILE  Specify a file to log output. Disabled by default.
  -h, --help           Show help message and exit.
  --debug              Show tracebacks on errors.

Commands:
  complete       print bash completion command (cliff)
  delete         Do DELETE request
  get            Do GET request
  help           print detailed help for another command (cliff)
  init           Initialize template files in current directory
  list           Fetch a list of results
  patch          Do PATCH request
  post           Do POST request
  put            Do PUT request
  show           SHOW a particular result

Initialize workspace

mkdir myworkspace
cd myworkspace
recli init

# A template file is generated
cat sites.yml
description: My favourite sites
sites:    
  github_jobs:
    base_url: https://jobs.github.com
    endpoints:
      positions:
        route: positions.json
        timeout: 10
        methods:
          - GET
  testing:
    base_url: https://jsonplaceholder.typicode.com
    endpoints:
      todos:
        route: todos
      todo1:
        route: todos/1

Do CRUD requests

recli get testing/todos
recli post testing/todos --kwargs title=abcd userId=10
recli put testing/todos/1 --kwargs title=abcd
recli patch testing/todo1 --kwargs title=xyz
recli delete testing/todos/1

Special formatting of data

List

recli help list
usage: recli list [-h] [-f {csv,json,table,value,yaml}] [-c COLUMN]
                  [--quote {all,minimal,none,nonnumeric}]
                  [--max-width <integer>] [--fit-width] [--print-empty]
                  [--noindent] [--sort-column SORT_COLUMN]
                  [-k [KWARGS [KWARGS ...]]] [-t TIMEOUT]
                  endpoint

Fetch a list of results

positional arguments:
  endpoint

optional arguments:
  -h, --help            show this help message and exit
  -k [KWARGS [KWARGS ...]], --kwargs [KWARGS [KWARGS ...]]
  -t TIMEOUT, --timeout TIMEOUT

output formatters:
  output formatter options

  -f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
                        specify the column(s) to include, can be repeated
  --sort-column SORT_COLUMN
                        specify the column(s) to sort the data (columns
                        specified first have a priority, non-existing columns
                        are ignored), can be repeated

CSV Formatter:
  --quote {all,minimal,none,nonnumeric}
                        when to include quotes, defaults to nonnumeric

table formatter:
  --max-width <integer>
                        Maximum display width, <1 to disable. You can also use
                        the CLIFF_MAX_TERM_WIDTH environment variable, but the
                        parameter takes precedence.
  --fit-width           Fit the table to the display width. Implied if --max-
                        width greater than 0. Set the environment variable
                        CLIFF_FIT_WIDTH=1 to always enable
  --print-empty         Print empty table if there is no data to show.

json formatter:
  --noindent            whether to disable indenting the JSON

Show

recli help show
usage: recli show [-h] [-f {json,shell,table,value,yaml}] [-c COLUMN]
                  [--max-width <integer>] [--fit-width] [--print-empty]
                  [--prefix PREFIX] [--noindent] [-k [KWARGS [KWARGS ...]]]
                  [-t TIMEOUT]
                  endpoint

SHOW a particular result

positional arguments:
  endpoint

optional arguments:
  -h, --help            show this help message and exit
  -k [KWARGS [KWARGS ...]], --kwargs [KWARGS [KWARGS ...]]
  -t TIMEOUT, --timeout TIMEOUT

output formatters:
  output formatter options

  -f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml}
                        the output format, defaults to table
  -c COLUMN, --column COLUMN
                        specify the column(s) to include, can be repeated

table formatter:
  --max-width <integer>
                        Maximum display width, <1 to disable. You can also use
                        the CLIFF_MAX_TERM_WIDTH environment variable, but the
                        parameter takes precedence.
  --fit-width           Fit the table to the display width. Implied if --max-
                        width greater than 0. Set the environment variable
                        CLIFF_FIT_WIDTH=1 to always enable
  --print-empty         Print empty table if there is no data to show.

shell formatter:
  a format a UNIX shell can parse (variable="value")

  --prefix PREFIX       add a prefix to all variable names

json formatter:
  --noindent            whether to disable indenting the JSON

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

RESTEasyCLI-0.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distributions

resteasycli-0.0.1-py3.5.egg (8.7 kB view details)

Uploaded Source

RESTEasyCLI-0.0.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file RESTEasyCLI-0.0.1.tar.gz.

File metadata

  • Download URL: RESTEasyCLI-0.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for RESTEasyCLI-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ea3c3e881c76318359247cfc6a4d119fdf84cea5a5dcd70ed781c0111a3e1ac3
MD5 26f58b4a1b3acf125cae9552edb53ae3
BLAKE2b-256 972d8ef0e1dc68091e8d0aee4804bd313ea24a6ee56d53ea00bdca221de15a48

See more details on using hashes here.

Provenance

File details

Details for the file resteasycli-0.0.1-py3.5.egg.

File metadata

  • Download URL: resteasycli-0.0.1-py3.5.egg
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for resteasycli-0.0.1-py3.5.egg
Algorithm Hash digest
SHA256 0aec04d74357dedc79ce4d508775dd33a1762e9ee71cbbb4ba458fe62220faf1
MD5 c91e2d3b03ea7cd83042a53daac969fa
BLAKE2b-256 e4148e4cab93d5546f80203e10e90145ffcf18e46607505b9cc9f2d32587eb9b

See more details on using hashes here.

Provenance

File details

Details for the file RESTEasyCLI-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: RESTEasyCLI-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for RESTEasyCLI-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 660469e4272ec7e7ca1e79864f1e50af80e5b1f4b38599b91a5496a3d23527b6
MD5 3a77b6aade15d90526371897dce2c96b
BLAKE2b-256 986aecc3a187cde0e52b76b8d6afa6e5493d70842367cb3ae61bb0798e938ea7

See more details on using hashes here.

Provenance

Supported by

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