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.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: RESTEasyCLI-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 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.1.0.tar.gz
Algorithm Hash digest
SHA256 3297046860c7e714531ef397fdb68ec1526d3558199c55fd00f5b96117be9883
MD5 ae175bccf72fe0abe91385574190f52e
BLAKE2b-256 442a2992fc5abe19ded64bd5a441b15515f1a8ad3a97b0ac65d259f403c53847

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: RESTEasyCLI-0.1.0-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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3fffc3eb86a4439bfd158429d32a52911dc601f7ab513ddc5886ffb9b32187c
MD5 aa5d2fd23591bf68f4d5df333f1ea42d
BLAKE2b-256 8d9f47f945ccd7e477651d1f3976b31f011f26b26b23e276a585ad225c7d90f9

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