Skip to main content

Handy REST API client on your terminal

Project description

RESTEasyCLI

Handy REST API client on your terminal

asciicast

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

Uploaded Source

Built Distribution

RESTEasyCLI-0.1.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: RESTEasyCLI-0.1.2.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.1.2.tar.gz
Algorithm Hash digest
SHA256 608902c4ac85e03eaee89f4969bfab132e65133aa79520feb360d0db5f21e1d7
MD5 2d30d405172176ecc4a876fe91eead7e
BLAKE2b-256 8a13db2c30bbe57a6ec6afb3605131d7503d4492207fe55b491245bb9aadd5de

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: RESTEasyCLI-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d38e6d1b990a77905103045878d8c5399be2d02e62b67a255d20d7e9daecff40
MD5 a098d1af58dcf179a831db874d6d1367
BLAKE2b-256 1c715366f02d68d9a15e8dd49a10c242bae8dc6874eabdcfe66b46c3004d8e39

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