Giter VIP home page Giter VIP logo

poster_boy's Introduction

Poster Boy

A command line tool allowing you to run API requests in bulk, using a request template and a CSV of data to "mail merge" into the request template.

Execution

  $ bin/poster_boy --template my-template.yml.erb --data my-data.csv --execute

... or just run bin/poster_boy --help for documentation.

Exclude the --execute argument to see the results of a dry run (just the details of the API requests that would be run).

Request templates

A ERB of a YAML file is used so that you can specifically which parts of your file should be filled in dynamically.

method: POST
target_url: https://an.url
basic_authentication: # optional
  user_name: my_user_name
  password: my_password
headers: # optional
  name: <%= csv_row['user_name'] %>
parameters: # optional
  api_token: <%= prompt_for_secret_data 'Please enter the API token:' %>
  request_body: <%= csv_row['html_email_body'] %>

In the basic_authentication section, specify the user name and password you want to use for basic authentication.

In the headers section, specify the name/value pairs you want to go into the request headers.

In the parameters section, specify the full parameter structure you want sent.

There are two options for substituting dynamic data into the request:

  1. Use the prompt_for_secret_data method. This will prompt the user to type in the value at runtime. This is useful for secret things (like passwords or API tokens) that you don't want to leave lying around unencrypted on your file system.
  2. Access the data from each row of the CSV file using the convention csv_row['column_name'].

Data files

Use standard CSVs with named columns (the first row should just be the column names so you can reference them in your template).

poster_boy's People

Watchers

James Cloos 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.