mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-11 15:51:19 +00:00
Additional python usage examples
This commit is contained in:
parent
5aba9d6196
commit
d36d4fb543
5 changed files with 25 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -174,6 +174,14 @@ thing: they fire off a HTTP GET method.</p>
|
|||
|
||||
{% include "front/snippets/python_urllib2.html" %}
|
||||
|
||||
<p>
|
||||
You can include additional diagnostic information in the
|
||||
in the request body (for POST requests), or in the "User-Agent"
|
||||
request header:
|
||||
</p>
|
||||
|
||||
{% include "front/snippets/python_requests_payload.html" %}
|
||||
|
||||
<a name="ruby"></a>
|
||||
<h3 class="docs-example">Ruby</h3>
|
||||
{% include "front/snippets/ruby.html" %}
|
||||
|
|
8
templates/front/snippets/python_requests_payload.html
Normal file
8
templates/front/snippets/python_requests_payload.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<div class="highlight"><pre><span></span><span class="c1"># Passing diagnostic information in the POST body:</span>
|
||||
<span class="kn">import</span> <span class="nn">requests</span>
|
||||
<span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">"{{ ping_url }}"</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="s2">"temperature=-7"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Passing diagnostic information in the User-Agent header:</span>
|
||||
<span class="kn">import</span> <span class="nn">requests</span>
|
||||
<span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"{{ ping_url }}"</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="p">{</span><span class="s2">"User-Agent"</span><span class="p">:</span> <span class="s2">"temperature=-7"</span><span class="p">})</span>
|
||||
</pre></div>
|
7
templates/front/snippets/python_requests_payload.txt
Normal file
7
templates/front/snippets/python_requests_payload.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
# 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"})
|
Loading…
Add table
Reference in a new issue