A simple Flask webserver to log all incoming requests with their headers and payloads
Project description
postbin
A simple Flask webserver to log all incoming requests with their headers and payloads.
Installation
Install postbin using pip:
pip install postbin
Usage
Start the server with
$ postbin
Then make requests, e.g. with curl:
curl -X POST http://127.0.0.1:5000 \
-H "Content-Type: application/json" \
-H "Custom-Header: CustomValue" \
-d '{"key1":"value1","key2":"value2"}'
The postbin prints:
Request Headers
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ Header ┃ Value ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ Host │ 127.0.0.1:5000 │
│ User-Agent │ curl/7.68.0 │
│ Accept │ */* │
│ Content-Type │ application/json │
│ Custom-Header │ CustomValue │
│ Content-Length │ 33 │
└────────────────┴──────────────────┘
JSON Payload: {'key1': 'value1', 'key2': 'value2'}
Examples
A simple GET request
curl -i -H "some-header: some-value" localhost:5000/foo/bar?somequery=somevalue
Output:
[06:31:34] Received Request: GET /foo/bar
Request Headers
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Header ┃ Value ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ Host │ localhost:5000 │
│ User-Agent │ curl/7.68.0 │
│ Accept │ */* │
│ Some-Header │ some-value │
└─────────────┴────────────────┘
Data Payload: b''
Multi-dict support of form data
Input:
curl -X PUT "http://127.0.0.1:5000/" \
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \
-H "X-Test-Header: foo bar" \
-H "Accept: application/json" \
--data-raw "key1"="value1" \
--data-raw "array1[]"="value1" \
--data-raw "array1[]"="value2" \
--data-raw "key2"="value1"
Output:
[06:48:08] Received Request: PUT /
Request Headers
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Header ┃ Value ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Host │ localhost:5000 │
│ User-Agent │ curl/7.68.0 │
│ Content-Type │ application/x-www-form-urlencoded; charset=utf-8 │
│ X-Test-Header │ foo bar │
│ Accept │ application/json │
│ Content-Length │ 55 │
└────────────────┴──────────────────────────────────────────────────┘
Form Data:
key1: value1
array1[]: value1
array1[]: value2
key2: value1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
postbin-0.2.0.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file postbin-0.2.0.tar.gz
.
File metadata
- Download URL: postbin-0.2.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d06a6a9497fb15c3e79f13d6417e7955b6369b48eb43ed0262c0504e73bbee9 |
|
MD5 | 809c5fa3fdd1d084bb33b59576438149 |
|
BLAKE2b-256 | 47d0eb8c9d70fec1e0705e2156c827cd4bcad2df751a3a7eec19a33bddbd5fea |
File details
Details for the file postbin-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: postbin-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d3c4f5f33ed95dea1ca8f88c0f79fb18aa10d426ca13f98a9e87fc49e6294e2 |
|
MD5 | 16bd06e8d7587acc01035262812cb224 |
|
BLAKE2b-256 | b33ddb9f0c200bb712c8ceea6cfa9f948baf96678009dfffd505357ad82d5037 |