Skip to content

Instantly share code, notes, and snippets.

@up1
Last active February 1, 2025 15:02
Show Gist options
  • Save up1/a441d0beed6bea37a6b5e3fc3e0c1e67 to your computer and use it in GitHub Desktop.
Save up1/a441d0beed6bea37a6b5e3fc3e0c1e67 to your computer and use it in GitHub Desktop.
Posting :: API tesing in terminal
# quick install on MacOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# install Posting (will also quickly install Python 3.12 if needed)
uv tool install --python 3.12 posting
# Use to run script
uv tool install posting --with httpx
# Start
$posting
name: demo01
url: https://jsonplaceholder.typicode.com/users/1
scripts:
on_response: testing/test_response.py
from posting import Posting
import httpx
def on_response(response: httpx.Response, posting: Posting) -> None:
print(response.status_code)
# check status code 200
if response.status_code == 200:
posting.notify("Success")
else:
posting.notify("Failed", severity="error")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment