diff --git a/CHANGELOG.md b/CHANGELOG.md index a1fddc0b..922c4d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. ### Improvements - Set Pushover alert priorities for "down" and "up" events separately - +- Additional python usage examples ### Bug Fixes - Fix after-login redirects (the "?next=" query parameter) diff --git a/hc/front/management/commands/pygmentize.py b/hc/front/management/commands/pygmentize.py index b068fc24..5af2eb8e 100644 --- a/hc/front/management/commands/pygmentize.py +++ b/hc/front/management/commands/pygmentize.py @@ -36,6 +36,7 @@ class Command(BaseCommand): _process("python_urllib2", lexers.PythonLexer()) _process("python_requests", lexers.PythonLexer()) _process("python_requests_fail", lexers.PythonLexer()) + _process("python_requests_payload", lexers.PythonLexer()) _process("php", lexers.PhpLexer()) _process("powershell", lexers.shell.PowerShellLexer()) _process("powershell_inline", lexers.shell.BashLexer()) diff --git a/templates/front/docs.html b/templates/front/docs.html index 3b5049d1..bf90b936 100644 --- a/templates/front/docs.html +++ b/templates/front/docs.html @@ -174,6 +174,14 @@ thing: they fire off a HTTP GET method.
{% include "front/snippets/python_urllib2.html" %} ++ You can include additional diagnostic information in the + in the request body (for POST requests), or in the "User-Agent" + request header: +
+ +{% include "front/snippets/python_requests_payload.html" %} +# Passing diagnostic information in the POST body:
+import requests
+requests.post("{{ ping_url }}", data="temperature=-7")
+
+# Passing diagnostic information in the User-Agent header:
+import requests
+requests.get("{{ ping_url }}", headers={"User-Agent": "temperature=-7"})
+