Skip to main content

HTTPDummy

                                    __________________
                                   /        ________  \
                                  /   _____|       |___\
                                 |   /  __         __   |
                                /|  |  /o \   _   /o \  |  
                               | | /           \        |
                                \|/   __           __   |
                                  \    |\_________/|   /   
                                   \___|___________|__/                  
                                        |         |
                                       /\_________/\
    _   _ _____ _____ ____  ____     _/     \ /     \_
   | | | |_   _|_   _|  _ \|  _ \ _ | _ _ __ V__  _ __|___  _   _
   | |_| | | |   | | | |_) | | | | | | | '_ ` _ \| '_ ` _ \| | | |
   |  _  | | |   | | |  __/| |_| | |_| | | | | | | | | | | | |_| |
   |_| |_| |_|   |_| |_|   |____/ \__,_|_| |_| |_|_| |_| |_|\__, |
                                                            |___/

HTTPDummy is a development HTTP server tool that prints information about the requests it receives to stdout.

Installation

With PIP:

pip install httpdummy

With Docker:

docker pull ksofa2/httpdummy

Usage

usage: httpdummy [-h] [-H [HEADERS]] [-B [BODY]] [-a ADDRESS] [-p PORT]
                 [-r [RESPONSE_FILE]]

A dummy http server that prints requests and responds

optional arguments:
  -h, --help            show this help message and exit
  -H [HEADERS], --headers [HEADERS]
  -B [BODY], --body [BODY]
  -a ADDRESS, --address ADDRESS
  -p PORT, --port PORT
  -r [RESPONSE_FILE], --response-file [RESPONSE_FILE]
  • Add the -H flag to print request headers.
  • Add the -B flag to print request body.

Use the --response-file to specify a YAML file to set up custom responses for arbitrary method / path combinations. For example, this command...

httpdummy --response-file ~/repsonses.yaml

... with ~/responses.yaml contents ...

---
responses:
  GET /api/foo:
    status: 200
    headers:
      Foo: bar
      Sna: fu
    body: |+
      Hi there!

      How are you?

  POST /api/foo:
    status: 201
    headers:
      Content-type: application/json
    body: |+
      {"answer": 42}

... will make HTTPDummy respond to POST requests to /api/foo with the 201 status code, and the configured headers and body.

NOTE: When started with a response file, HTTPDummy will listen for changes to that file and restart when a change is detected to reload the response definitions.

Environment Variables

These environmental variables will be used as values for their corresponding command-line options. If the command-line option is used, that value will override the one set in the environment.

  • HTTPDUMMY_ADDRESS
  • HTTPDUMMY_PORT
  • HTTPDUMMY_HEADERS
  • HTTPDUMMY_BODY
  • HTTPDUMMY_RESPONSE_FILE

Docker

An image for HTTPDummy is available on DockerHub: https://hub.docker.com/r/ksofa2/httpdummy

docker run -it -p 127.0.0.1:5000:5000 ksofa2/httpdummy

NOTE: The HTTPDUMMY_HEADERS and HTTPDUMMY_BODY are turned on by default in the Docker image.

An example docker-compose.yaml file:

---
version: '3'

services:
  httpdummy:
    image: ksofa2/httpdummy
    environment:
      - HTTPDUMMY_RESPONSE_FILE=/srv/responses.yaml
    ports:
      - 127.0.0.1:5000:5000
    volumes:
      - .:/srv

Metadata

Release files for httpdummy 1.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httpdummy 1.1.7
File Size Uploaded Provenance Actions
httpdummy-1.1.7.tar.gz 8.5 kB Without provenance Details for httpdummy-1.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for httpdummy 1.1.7
File Interpreter ABI Platform Actions
httpdummy-1.1.7-py3-none-any.whl Python 3 none any Details for httpdummy-1.1.7-py3-none-any.whl

Total release size: 17.3 kB

Release files / httpdummy-1.1.7.tar.gz

Download URL httpdummy-1.1.7.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6d79d0bbe8895907b21e0321ca409ec2165b7866882889a895d40558ba49df07
BLAKE2b-256 checksum
How to use checksums
9562b7bd795144eff4731d5d9108f95c697788b1e55e1bfb6ed1f14537b71219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / httpdummy-1.1.7-py3-none-any.whl

Download URL httpdummy-1.1.7-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c60947e069757e3312cea923a8355f716966f0d4be6f9d91f99f9b8dacb0cada
BLAKE2b-256 checksum
How to use checksums
b69333d292b334c8e72fd5e74ed1d39b480122c9f1ac5edb0942a2cbf8cacb33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Security for httpdummy 1.1.7

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page