██████╗ ██╗ ██╗ █████╗ ███████╗███████╗ ██████╗ ██╔═══██╗██║ ██║██╔══██╗██╔════╝██╔════╝██╔═══██╗ ██║ ██║██║ ██║███████║█████╗ ███████╗██║ ██║ ██║▄▄ ██║██║ ██║██╔══██║██╔══╝ ╚════██║██║ ██║ ╚██████╔╝╚██████╔╝██║ ██║███████╗███████║╚██████╔╝ ╚══▀▀═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ --------------------------------------------------- python cli program to send requests
Is it just me or is curl a little too complicated? Want something simpler in life? something made for humans? Try quaeso -- A Python program that reads a json/yml file for request data and sends the request
Installation
pip install this repo. (Note: Incompatible with Python 2.x)
pip3 install quaeso
(or)
pip install quaeso
Usage example
To get help with commandline arguments
quaeso --help
Using Command-line Arguments
quaeso -f "some/folder/myrequest.yml"
(or)
quaeso -f "some/folder/myrequest.json"
Colorize Output
quaeso -f "some/folder/myrequest.yml" -c
Disclaimer
sometimes the quaeso command doesn't work in windows if the package is installed globally.
to avoid this, install the package in a local virtual env
first, create a env
python3 -m venv env_for_quaeso
activate that env
.\env_for_quaeso\Scripts\activate
and then pip install. But you will have to activate that env everytime you want to use quaeso.
IO Redirection
the response is written to stdout and headers/status are written to stderr so that users can take IO redirection to their advantage. This works on windows, linux and mac.
quaeso -f "some/folder/myrequest.yml" > res.json 2> res_headers.txt
both stdout and stderr can be redirected to the same file
quaeso -f "some/folder/myrequest.yml" > res.txt 2>&1
Sample request file (myrequest.yml)
GET
url: https://cdn.animenewsnetwork.com/encyclopedia/api.xml?anime=4658
method: get
params:
offset: 2
limit: 100
headers:
accept: text/xml
accept-language: en
timeout: 5000
File Download (quaeso -f "some/folder/myrequest.yml" > book.pdf)
url: http://do1.dr-chuck.com/pythonlearn/EN_us/pythonlearn.pdf
method: get
POST
url: https://jsonplaceholder.typicode.com/todos/
method: POST
headers:
Authorization: Basic bXl1c2VybmFtZTpteXBhc3N3b3Jk
content-type: application/json
data:
title: walk the dog
completed: false
timeout: 5000
PUT
url: https://jsonplaceholder.typicode.com/todos/1
method: PUT
headers:
content-type: application/json
data:
title: walk the dog
completed: true
timeout: 5000
DELETE
url: https://jsonplaceholder.typicode.com/todos/1
method: DELETE
Complete request file with all available fields (myrequest.yml)
method: XXX # (REQUIRED) GET, OPTIONS, HEAD, POST, PUT, PATCH, or DELETE
url: XXX # (REQUIRED) must be prefixed with http:// or https://
params: # url query parameters. have as many as you like
offset: 0
limit: 10
data: # data for POST
name: john
age: 22
hobbies:
- running
- eating
- sleeping
# you can also type data in json format instead of yaml
data: |
{
"name": "john",
"age": 22,
"hobbies": ["running", "eating", "sleeping"]
}
headers: # have as many as you like
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
cookies: # have as many as you like
mycookie: cookievalue
myothercookie: othercookievalue
timeout: 3.14 # seconds
allow_redirects: true # true or false
proxies: # have as many as you like
http: http://10.10.1.10:3128
https: https://10.10.1.11:1080
ftp: ftp://10.10.1.10:3128
# EITHER verify server's TLS certificate. true or false
verify: true
# OR path to a CA bundle to use
verify: some/folder/cacert.crt
# EITHER path to single ssl client cert file (*.pem)
cert: some/folder/client.pem
# OR (*.cert), (*.key) pair.
cert:
- some/folder/client.cert
- some/folder/client.key
Development setup
Clone this repo and install packages listed in requirements.txt
pip3 install -r requirements.txt
Meta
M. Zahash – zahash.z@gmail.com
Distributed under the MIT license. See LICENSE for more information.
Contributing
- Fork it (https://github.com/zahash/quaeso/fork)
- Create your feature branch (
git checkout -b feature/fooBar) - Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
Metadata
Release files for quaeso 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quaeso-0.1.2.tar.gz | 6.6 kB | Without provenance | Details for quaeso-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quaeso-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for quaeso-0.1.2-py3-none-any.whl |
Total release size: 14.1 kB
Release files / quaeso-0.1.2.tar.gz
| Download URL | quaeso-0.1.2.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
439f3809d1b37595aa67dfe5838fcf15c63a445ba5d22c8de250e701b2a6b350
|
|
BLAKE2b-256 checksum How to use checksums |
7f6abca46d10c4ba6e6b4bd3ae3908b2efa1b17e5d102059dae19e756705826c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / quaeso-0.1.2-py3-none-any.whl
| Download URL | quaeso-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df13225c1804385d9501ea1110cfe013af343c80c9ab53b78d98a61d917e5573
|
|
BLAKE2b-256 checksum How to use checksums |
4c3c347993f13d645f6ea2ce3b88bc7fdefb066d4965e02ea52f4716840bae3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for quaeso 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.