diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-08-23 12:37:02 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-08-23 12:37:02 +1200 |
commit | b78a3817cdddd4bc43a7d3159382283f25a22fa7 (patch) | |
tree | 75a8a9b3ba935b0fb795bab301b97562ae83cd60 /libpathod | |
parent | d758409b76454db983b28b023653aad977181717 (diff) | |
download | mitmproxy-b78a3817cdddd4bc43a7d3159382283f25a22fa7.tar.gz mitmproxy-b78a3817cdddd4bc43a7d3159382283f25a22fa7.tar.bz2 mitmproxy-b78a3817cdddd4bc43a7d3159382283f25a22fa7.zip |
Adjust examples and docs.
Diffstat (limited to 'libpathod')
-rw-r--r-- | libpathod/templates/about.html | 22 | ||||
-rw-r--r-- | libpathod/templates/examples_context.html | 29 |
2 files changed, 30 insertions, 21 deletions
diff --git a/libpathod/templates/about.html b/libpathod/templates/about.html index 4d74c126..3c05ad2d 100644 --- a/libpathod/templates/about.html +++ b/libpathod/templates/about.html @@ -4,22 +4,32 @@ <section> <div class="page-header"> <h1> - where - <small>to get the code.</small> + how + <small>to get it.</small> </h1> </div> - <h3>git clone git://github.com/cortesi/pathod.git</h3> + <p>The easiest way to install pathod is to use pip:</p> + + <pre>pip install pathod</pre> + + <p> You can find the project source on GitHub: </p> + + <div style="margin-top: 20px; margin-bottom: 20px"> + <a class="btn btn-primary btn-large" href="https://github.com/cortesi/pathod">github.com/cortesi/pathod</a> + </div> + + <p>Please also use the <a + href="https://github.com/cortesi/pathod/issues">github issue tracker</a> to + report bugs. </p> - <p>Please use the <a href="http://github.com/cortesi/pathod/issues">github - issue tracker</a> to report bugs. </p> </section> <section> <div class="page-header"> <h1> why - <small>this was written.</small> + <small>this it written.</small> </h1> </div> diff --git a/libpathod/templates/examples_context.html b/libpathod/templates/examples_context.html index 3d33e76d..39146d37 100644 --- a/libpathod/templates/examples_context.html +++ b/libpathod/templates/examples_context.html @@ -1,24 +1,23 @@ <div class="highlight"><pre><span class="kn">import</span> <span class="nn">requests</span> <span class="kn">from</span> <span class="nn">libpathod</span> <span class="kn">import</span> <span class="n">test</span> -<span class="k">class</span> <span class="nc">Test</span><span class="p">:</span> +<span class="k">def</span> <span class="nf">test_simple</span><span class="p">():</span> <span class="sd">"""</span> -<span class="sd"> Testing the requests module with </span> +<span class="sd"> Testing the requests module with</span> <span class="sd"> a pathod context manager.</span> <span class="sd"> """</span> - <span class="k">def</span> <span class="nf">test_simple</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> - <span class="c"># Start pathod in a separate thread</span> - <span class="k">with</span> <span class="n">test</span><span class="o">.</span><span class="n">Daemon</span><span class="p">()</span> <span class="k">as</span> <span class="n">d</span><span class="p">:</span> - <span class="c"># Get a URL for a pathod spec</span> - <span class="n">url</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">p</span><span class="p">(</span><span class="s">"200:b@100"</span><span class="p">)</span> - <span class="c"># ... and request it</span> - <span class="n">r</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">url</span><span class="p">)</span> + <span class="c"># Start pathod in a separate thread</span> + <span class="k">with</span> <span class="n">test</span><span class="o">.</span><span class="n">Daemon</span><span class="p">()</span> <span class="k">as</span> <span class="n">d</span><span class="p">:</span> + <span class="c"># Get a URL for a pathod spec</span> + <span class="n">url</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">p</span><span class="p">(</span><span class="s">"200:b@100"</span><span class="p">)</span> + <span class="c"># ... and request it</span> + <span class="n">r</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">url</span><span class="p">)</span> - <span class="c"># Check the returned data</span> - <span class="k">assert</span> <span class="n">r</span><span class="o">.</span><span class="n">status_code</span> <span class="o">==</span> <span class="mi">200</span> - <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">content</span><span class="p">)</span> <span class="o">==</span> <span class="mi">100</span> + <span class="c"># Check the returned data</span> + <span class="k">assert</span> <span class="n">r</span><span class="o">.</span><span class="n">status_code</span> <span class="o">==</span> <span class="mi">200</span> + <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">content</span><span class="p">)</span> <span class="o">==</span> <span class="mi">100</span> - <span class="c"># Check pathod's internal log</span> - <span class="n">log</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">last_log</span><span class="p">()[</span><span class="s">"request"</span><span class="p">]</span> - <span class="k">assert</span> <span class="n">log</span><span class="p">[</span><span class="s">"method"</span><span class="p">]</span> <span class="o">==</span> <span class="s">"PUT"</span> + <span class="c"># Check pathod's internal log</span> + <span class="n">log</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">last_log</span><span class="p">()[</span><span class="s">"request"</span><span class="p">]</span> + <span class="k">assert</span> <span class="n">log</span><span class="p">[</span><span class="s">"method"</span><span class="p">]</span> <span class="o">==</span> <span class="s">"PUT"</span> </pre></div> |