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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for brestclient-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a0b3542c7cafa9d87ff4222c164b71e6da4b0916ebb402e4f24a559a346b2f |
|
MD5 | 622d3769601d617df184f7709ba97737 |
|
BLAKE2b-256 | dd0965895ab700223a817ff2cfe47c6eb54981924009bbdc394287fbbce7df1d |