Skip to main content

RESTFul HTTP command-line interface and shell

Project description

USAGE: resht HTTP-VERB PATH [API_PARAMS] [ARGUMENTS]

JSON-oriented REST API client with shell mode for session-based flows.

EXAMPLES:
---------------------------------------------------------------------------
    $ resht -u https://example.com/api get foo x=1
    {...}

    $ resht -u https://example.com/api/
    > get site/foo.com -v
    > post site -j domain=foo.com
    > cd site/foo.com
    > get ./

ARGUMENTS
---------------------------------------------------------------------------

    REQUEST ARGS
   -B, --basic USER:PASS    HTTP basic authentication.
   -d, --data DATA          Set request body to the string given; cannot be
                            used with API params or --json
   -H, --header HEADER      HTTP header (e.g. 'Foo: bar', repeatable)
   -I, --insecure           Do not valid SSL certificates (dangerous!)
   -Q, --query QUERY_DATA   Extra query data to merge
                            (e.g. "foo=bar&food=yummy", repeatable).
   -f, --form               Override default of sending JSON data
   -j, --json STRING        Merge JSON-encoded string into API params (repeatable)
   -u, --url URL            Base URL for API requests (default: https://localhost/).


    MISC ARGS
   -h, --help               This information.
   -s, --shell              Start shell mode; run initial API
   -v, --verbose            Print verbose debugging info to stderr.

    OUTPUT ARGS:
   -c, --color              Color formatted JSON responses (default=True).
   -C, --no-color           Do not color formatted JSON responses.
   -r, --raw                Don't format response data; return raw response.
   -x, --extract PATH       Parse JSON to return specific data; may be repeated.
   -X, --exclude PATH       Exclude specified path from JSON data; may be repeated.
   > FILE                   Write API response to specified file.
   >> FILE                  Append API response to specified file.

API PARAMS
---------------------------------------------------------------------------
    API parameters are defined through a terse dotted notation making nested
    objects easy to quickly define. Non-boolean values are assigned using
    the delimiter "=" (string) or ":=" (JSON encoded).

    Arrays must be created using ":=" or using "-d|--data".

    BOOLEANS:
       foo                      {"foo": true}
       foo.bar                  {"foo": {"bar": true}}
       ^foo                     {"foo": false}
       !foo                     {"foo": false}

    STRINGS:
       foo=bar                  {"foo": "bar"}
       foo.bar=3 foo.bard=abc   {"foo": {"bar": "3", "bard": "abc"}}

    OTHER (RAW JSON):
       foo:='{"bar":3}'         {"foo": {"bar": 3}}
       foo.bar:=3.14            {"foo": {"bar": 3.14}}

JSON PATHS  (-x|--extract, -X|--exclude)
---------------------------------------------------------------------------
    The JSON data can be filtered based on index, key matches, ranges, etc.

    Arrays:
        By Index:
         - 'foo/0', 'foo/2', 'foo/-1' (last item)
        By Range:
         - 'foo/:' or 'foo/*' (all items within the array),
         - 'foo/2:', 'foo/:2', 'foo/1:5', 'foo/-2:' (last 2),
         - 'foo/:-2' (all but last two),
         - 'foo/1:-3' (between first and up until 3rd to last)
    Dictionaries:
        Regular Expressions:
         - 'foo/b..?r' = foo/bar, foo/beer
         - 'foo/bar/.*[pP]assw(or)?d' == anything within foo/bar like a password

SHELL COMMANDS
---------------------------------------------------------------------------
   HTTP_VERB URL [PARAMS]     Perform request
   cd                         Change the base URL (e.g. "cd customers/8; cd ../9").
   help                       This information.
   quit                       Adios! (quit shell).
   headers [key=val, -key]    List, set, or clear headers.
   set [PARAMS]               List or set configuration options.
   sh EXPR                    Run a BASH shell command.

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

resht-0.9.4.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

resht-0.9.4-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file resht-0.9.4.tar.gz.

File metadata

  • Download URL: resht-0.9.4.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for resht-0.9.4.tar.gz
Algorithm Hash digest
SHA256 2b11bfa64348d49e06bd95a14d0dda99b8620b9882942c956aa561241ded14e1
MD5 75cd66ad214f5619e308661c79fb2dfc
BLAKE2b-256 54427729ddb2b9a137cad6d5f63c4cfce86c9c1e3e1a612858b8dafb449a1bb8

See more details on using hashes here.

File details

Details for the file resht-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: resht-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for resht-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 837c1b6213dccd865593574c25f3a60e0618c4772205f904afcbaec279225389
MD5 b63b2fdf3fc367c454ef8824b40f60fd
BLAKE2b-256 0e7643dd2b8cd78ea795b3f949f8c59687a85f4674182b8e1dc754bc2f6d1b62

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