mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Examples and documentation.
This commit is contained in:
parent
3ca3e7c485
commit
791252ac5e
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
pygmentize -f html ./examples_context.py > ../libpathod/templates/examples_context.html
|
||||
pygmentize -f html ./examples_setup.py > ../libpathod/templates/examples_setup.html
|
||||
pygmentize -f html ./examples_setupall.py > ../libpathod/templates/examples_setupall.html
|
||||
pygmentize -f html ../examples/test_context.py > ../libpathod/templates/examples_context.html
|
||||
pygmentize -f html ../examples/test_setup.py > ../libpathod/templates/examples_setup.html
|
||||
pygmentize -f html ../examples/test_setupall.py > ../libpathod/templates/examples_setupall.html
|
||||
pygmentize -f html ../examples/libpathod_pathoc.py > ../libpathod/templates/libpathod_pathoc.html
|
||||
|
1
examples/pathoc.py → examples/libpathod_pathoc.py
Executable file → Normal file
1
examples/pathoc.py → examples/libpathod_pathoc.py
Executable file → Normal file
@ -4,3 +4,4 @@ from libpathod import pathoc
|
||||
p = pathoc.Pathoc("google.com", 80)
|
||||
p.connect()
|
||||
print p.request("get:/")
|
||||
print p.request("get:/foo")
|
@ -3,8 +3,8 @@ from libpathod import test
|
||||
|
||||
class Test:
|
||||
"""
|
||||
Testing the requests module with
|
||||
a pathod instance started for
|
||||
Testing the requests module with
|
||||
a pathod instance started for
|
||||
each test.
|
||||
"""
|
||||
def setUp(self):
|
@ -1,7 +1,27 @@
|
||||
{% extends "frame.html" %}
|
||||
{% block body %}
|
||||
|
||||
Foo
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
libpathod
|
||||
<small>Using pathod and pathoc in code.</small>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span6">
|
||||
|
||||
<p> Behind the pathod and pathoc command-line tools lurks
|
||||
<b>libpathod</b>, a powerful library for manipulating and serving HTTP
|
||||
requests and responses. The canonical documentation for the library is
|
||||
in the code, and can be accessed using pydoc.</p>
|
||||
|
||||
</div>
|
||||
<div class="span6">
|
||||
<h1> pathoc </h1>
|
||||
|
||||
{% include "libpathod_pathoc.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
<span class="k">class</span> <span class="nc">Test</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Testing the requests module with </span>
|
||||
<span class="sd"> a pathod instance started for </span>
|
||||
<span class="sd"> Testing the requests module with</span>
|
||||
<span class="sd"> a pathod instance started for</span>
|
||||
<span class="sd"> each test.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
|
@ -66,26 +66,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top: 50px" class="row">
|
||||
<div class="span6">
|
||||
<div>
|
||||
<h1> <a href="/docs/test">libpathod.test</a> </h1>
|
||||
|
||||
<p>Using pathod in your unit tests.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div>
|
||||
<h1> <a href="/docs/test">libpathod.test</a> </h1>
|
||||
|
||||
<p>Using pathod in your unit tests.</p>
|
||||
|
||||
{% include "examples_context.html" %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
7
libpathod/templates/libpathod_pathoc.html
Normal file
7
libpathod/templates/libpathod_pathoc.html
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="highlight"><pre><span class="c">#!/usr/bin/env python</span>
|
||||
<span class="kn">from</span> <span class="nn">libpathod</span> <span class="kn">import</span> <span class="n">pathoc</span>
|
||||
|
||||
<span class="n">p</span> <span class="o">=</span> <span class="n">pathoc</span><span class="o">.</span><span class="n">Pathoc</span><span class="p">(</span><span class="s">"google.com"</span><span class="p">,</span> <span class="mi">80</span><span class="p">)</span>
|
||||
<span class="n">p</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
|
||||
<span class="k">print</span> <span class="n">p</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">"get:/"</span><span class="p">)</span>
|
||||
</pre></div>
|
Loading…
Reference in New Issue
Block a user