Skip to main content

best terminal rest client

Project description

brestclient

in terminal rest client, super simple and super useful

how to install

  • install python3
  • install with pip python3 -m pip install brestclient

how to use

overview

first of all create a file with requests
syntax similar to other rest clients:

then perform requests with python3 -m brestclient ./path/po/file

file syntax

### request name
# name REQUIRED to be UNIQUE in entire file
# there should not be any two requests with same name
# it's matter to have no spaces before ###
# all next lines started with # is a comments, will be ignored
# it's matter to use ### only in the begining of request
# cuz ### means a request start, for comments use # or ##
# METHOD - can be any html method, case does not matter
# URL - any valid http url, if protocol is not specified (google.com for example)
# request will be performed with https protocol
# headers - all what is left of : is a header key,
# all is right of : is a header value
# both will be striped
# body will be striped as one big line
METHOD URL?a={{in_url_variable}}
HEADER_KEY: HEADER_VALUE
HEADER_KEY: HEADER_VALUE
HEADER_{{var1}}: HEADER_{{var2}}

{
    "all lines till the end are {{variables_can_be_everywhere}} lines of a request body",
    "there can be anything, json or plane text, or nothing if it's GET request"
}

file example

### yandex request
# it's just a search get request, no headers or body requeired
GET https://ya.ru?q=coala


### ask google fo no reason
POST google.com?q=weffwe
Authorization: Bearer foj23fjjf03jf3029jf30jf3029j23f09
content-type: application/json

{
    "something": [1, 2, 3],
    "please_collect_all_my_data": true
}

perform requests

run brestclient with requests file specified

python3 -m brestclient ./path/to/file

then pick a request by number
when request will be done, it will print to you status code,
response headers and body. if body in json format - it will be pretty printed

also you can run it without interactive menu, for it specify --query or -q param
in this case request will be finded by it's name

python3 -m brestclient ./path/to/file -q google

or you can run it with -l or --list argument to print list of requests with their order number
and then run program with -n NUMBER or --request-number NUMBER to perform request
example:

python3 -m brestclient ./path/to/file -l
1: first request
2: second request
...

python3 -m brestclient ./path/to/file -n 2

development plans

  • just requests
  • json output parsing, pretty print
  • make it a python package
  • create documentation how to use
  • publish package
  • save output to variables, and ability to use them later
  • if response in html format - ask for open it in browser
  • flag -r to get raw response in http format
  • json output syntax coloring
  • html output parsing, pretty print and syntax coloring

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

brestclient-0.2.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

brestclient-0.2.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file brestclient-0.2.0.tar.gz.

File metadata

  • Download URL: brestclient-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.2 Linux/6.1.0-16-amd64

File hashes

Hashes for brestclient-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8f4bd02c4483c5d798e835e0b7a6b233e0a492ec3edc57523ac5cf4865ad673d
MD5 ada4560ff2a2e95239e6d71382d70aa0
BLAKE2b-256 d090669ee494781fe976b0679fc43d460a6fe3e51d3d0ec3edd63c46e3fe6ce8

See more details on using hashes here.

File details

Details for the file brestclient-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: brestclient-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.2 Linux/6.1.0-16-amd64

File hashes

Hashes for brestclient-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6a0b3542c7cafa9d87ff4222c164b71e6da4b0916ebb402e4f24a559a346b2f
MD5 622d3769601d617df184f7709ba97737
BLAKE2b-256 dd0965895ab700223a817ff2cfe47c6eb54981924009bbdc394287fbbce7df1d

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