Giter Site home page Giter Site logo

adz's Introduction

ADZ

Command line interface for HTTP requests defined in yaml configuration file.

Install

pip install adz

Quick start

Having a yaml configuration file

endpoints:
  endpoint:
    request: GET https://httpbin.org/get
    headers:
      Content-Type: application/json

and running on command line

adz endpoint

will execute endpoint request defined in configuration file and print

GET https://httpbin.org/get
HTTP/1.1 200 OK
 • access-control-allow-credentials: true
 • access-control-allow-origin: *
 • content-encoding: gzip
 • content-type: application/json
 • date: Thu, 06 Jun 2019 06:06:06 GMT
 • referrer-policy: no-referrer-when-downgrade
 • server: nginx
 • x-content-type-options: nosniff
 • x-frame-options: DENY
 • x-xss-protection: 1; mode=block
 • content-length: 204
 • connection: keep-alive

{
    "args": {},
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip, deflate",
        "Content-Type": "application/json",
        "Host": "httpbin.org",
        "User-Agent": "python-httpx/0.7.1"
    },
    "url": "https://httpbin.org/get"
}

Configuration

For an example configuration look at docs/example.yml.

settings

  • colors: bool, default: true
    • control output print in colors
  • response: bool, default: true
    • control response body output
  • theme: str, default native
    • any theme name from here should work

variables

  • used to interpolate values in headers and urls
    • variable: abc applied on url: http://example.org/$variable results in http://example.org/abc
  • variable value starting with file:// is opened as file and loaded as string into variable

endpoints

  • description
  • method
    • http methods
  • url
  • request
    • method url e.g. get http://example.org
  • params
    • query string parameters
  • headers
  • json
    • json string
    • string starting with file:// is loaded as json file
  • data
    • json string
    • string starting with file:// is loaded as json file
  • cookies
  • files
    • path to a file: path/to/file.txt
    • file name and path: filename: path/to/file.txt

Configuration file

Expected configuration file names
  • adz.yaml or adz.yml
  • api.yaml or api.yml
  • rest.yaml or rest.yml
Expected locations
  • current location: .
  • user's home: ~/
  • .adz directory in user's home e.g. ~/.adz/

Configuration file path can also be set using environmental variable ADZ.

CLI

Run adz -h

commands

  • adz --config, adz -c

    • path to yaml configuration file
  • adz --details <endpoint>, adz -d <endpoint>

    • output details about endpoint from configuration file
  • adz --list, adz -l

    • list available endpoints in configuration file
  • adz --output, adz -o

    • output processed configuration file as json
  • adz --settings, adz -s

    • output settings in configuration file
  • adz --var name=value, adz -v name=value

    • set or override variables in configuration
  • adz --colors, adz --no-colors

    • control output print in colors
  • adz --response, adz --no-response

    • control response body output

License

ADZ is licensed under a three clause BSD License. Full license text can be found here.

adz's People

Contributors

ambrozic avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.