Skip to main content

Console HTTP API tool

Project description

desman

Desman is console HTTP API requests tool. Desman uses .yml files to save request information. You can use enviroment files wich are also .yml files, to substitute variables to request.

Installation

Pip

pip install desman

How to use

Simple request

Create .yml file with request description:

method: get
url: http://host.com/

then pass file path to desman

desman path/to/file.yml

and desman prints the body of response to console.

Request with parameters

Query parameters can be passed in url

method: get
url: http://host.com/?param=value

or be passed separately

method: get
url: http://host.com/
params:
  param: value

Headers

Headers can be passed in headers field

method: get
url: http://host.com/
headers:
  Authorization: Bearer some-auth-token
params:
  param: value

Body

Body content can be passed in body field in request file

method: post
url: http://host.com/post
headers:
  Authorization: Bearer some-auth-token
body: |
  {
      "stringField": "JSON value",
      "nestedObject": {
          "nestedField": [1, 2, 3]
      }
  }

Output parameters

The output of HTTP response is controlled by these optional paramters:

  • -s print status of response
  • -H print heafers of response
  • -b print body of response

If none of these parameters are passed desman prints only body of response.

Using environments

All request files are Jinja2 templates.

# request.yml
method: post
url: http://{{server.host}}:{{server.port}}/post
headers:
  Authorization: Bearer {{my-token}}
body: |
  {
      "stringField": "JSON value",
      "nestedObject": {
          "nestedField": [1, 2, 3]
      }
  }

Variables are substituted from enviroment .yml files

# env.yml
server:
  host: host.com
  port: 8080
my-token: "some-auth-token"

which are passed in optional parameter -e

desman -e env.yml request.yml

You can use many enviroment files. If they have similar fields desman will use the last occurence of value.

With many enviroment files

# env.yml
server:
  host: host.com
  port: 8080
my-token: "some-auth-token"
# new-token.yml
my-token: "new-token"

if both passed as

desman -e env.yml -e new-token.yml request.yml

request will be performed with Authorization: Bearer new-token header.

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

desman-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

desman-1.0.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file desman-1.0.0.tar.gz.

File metadata

  • Download URL: desman-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for desman-1.0.0.tar.gz
Algorithm Hash digest
SHA256 168b11563362c968c4a7984ffb298ab8d77c6462a1919363e279b88a12df1907
MD5 e17fa229dbdc0a1e2cb26e1eb3ac0b14
BLAKE2b-256 fd5cacfe0f7e3a145845a3671da7ce5b7d6c5723fab25ef09ac621a58f1057b6

See more details on using hashes here.

File details

Details for the file desman-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: desman-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for desman-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84a08c9d1ed9cb0a923a7686bcaae9db283aad6a0748a49e9a61468a06c7fbc9
MD5 9a3bb5f57037a147b6e29eb299cd8f91
BLAKE2b-256 b5d828255b5e44c0d86c964c1ad96c0ae3a784db98618e7460bd575fc490547b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page