Skip to main content

Human-friendly HTTP requests as plain text files

Project description

Requestfile

Human-friendly HTTP requests as plain text files.

Python package

Features

  • Store HTTP requests as text files, with a familiar syntax
  • Easily specify query arguments, headers, cookies, form data, and file uploads
  • Include data from files
  • Interpolate variables passed from the command line
  • And more!

Usage

Requestfile can be used as either a command line tool, or as a library to use the format from third party tools.

Example

File request.txt:

POST http://httpbin.org/post
User-Agent: requestfile-example/0.1

%FIELD: username "user@example.com"
%FIELD: password "SuperSecret"
% requestfile send request.txt
{
  "args": {},
  "data": "",
  "files": {},
  "form": {
    "password": "SuperSecret",
    "username": "user@example.com"
  },
  "headers": {
    "Accept-Encoding": "identity",
    "Content-Length": "48",
    "Content-Type": "application/x-www-form-urlencoded",
    "Host": "httpbin.org",
    "User-Agent": "requestfile-example/0.1",
  },
  "json": null,
  "origin": "68.516.160.290",
  "url": "http://httpbin.org/post"
}

Quick overview

See SYNTAX.md for more details.

Commands to set query parameters, headers, cookies, form fields, multipart file uploads...

# Comments are ignored

POST http://example.com/signup
%PARAM: user_id "100"
%HEADER: x-auth-token <<EOF
th15-15-4-l0ng-s3cr3t-t0k3n
EOF
%COOKIE: session "eyJpZCI6MX0K"

%PARAM: username "admin"
%PARAM: password "TmljZSB0cnkK"|from-base64
%PART: picture <"profile-picture.png"

Passing arguments as variables

Variables can be used anywhere, and passed from the command line!

File request.txt:

# Edit a user's display name

%SET-DEFAULT: display_name "world"

POST "http://example.com/user/${user_id}"|interpolate
%HEADER: x-auth-token $auth_token

%FIELD: display_name $display_name
%FIELD: greeting "Hello, ${display_name}!"|interpolate

Fill in those variables from the command line:

requestfile send request.txt -a user_id=1 -a display_name="foobar"

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

requestfile-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requestfile-0.1.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file requestfile-0.1.0.tar.gz.

File metadata

  • Download URL: requestfile-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for requestfile-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d837b4d5b0afe3a41bbd5042c06e54dd2a33d73d35e38f4934f8bab2aab7eb08
MD5 29950b5ff04d841c7d8c8089a515c2cc
BLAKE2b-256 a1e931632eab71ffd6de9a493dd139415f4ad189a00c206a8f780c24738247ee

See more details on using hashes here.

File details

Details for the file requestfile-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for requestfile-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6da7ee9424683a611a11bb3eb0b4febabd99d78cbd34732e88bdac5ff7ab99
MD5 dcebb46ac25ce59e4d6fa468c51194bd
BLAKE2b-256 8c4ff0be635e5341690f47b6b5b5838c136e4dc40d7a79a471fbb643bb57d765

See more details on using hashes here.

Supported by

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