Examples and documentation.

This commit is contained in:
Aldo Cortesi 2012-11-02 14:22:54 +13:00
parent 3ca3e7c485
commit 791252ac5e
9 changed files with 37 additions and 30 deletions

View File

@ -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
View 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")

View File

@ -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):

View File

@ -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 %}

View File

@ -3,8 +3,8 @@
<span class="k">class</span> <span class="nc">Test</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</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"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

View File

@ -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 %}

View 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">&quot;google.com&quot;</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">&quot;get:/&quot;</span><span class="p">)</span>
</pre></div>