A fork of pappy proxy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1616 lines
98 KiB

9 years ago
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pappyproxy package &mdash; Pappy Proxy 0.2.0 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Pappy Proxy 0.2.0 documentation" href="index.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Pappy Proxy 0.2.0 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="pappyproxy-package">
<h1>pappyproxy package<a class="headerlink" href="#pappyproxy-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul class="simple">
</ul>
</div>
</div>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pappyproxy.comm">
<span id="pappyproxy-comm-module"></span><h2>pappyproxy.comm module<a class="headerlink" href="#module-pappyproxy.comm" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pappyproxy.config">
<span id="pappyproxy-config-module"></span><h2>pappyproxy.config module<a class="headerlink" href="#module-pappyproxy.config" title="Permalink to this headline"></a></h2>
<p>The configuration settings for the proxy.</p>
<dl class="data">
<dt id="pappyproxy.config.CERT_DIR">
<code class="descclassname">pappyproxy.config.</code><code class="descname">CERT_DIR</code><a class="headerlink" href="#pappyproxy.config.CERT_DIR" title="Permalink to this definition"></a></dt>
<dd><p>The location of the CA certs that Pappy will use. This can be configured in the
<code class="docutils literal"><span class="pre">config.json</span></code> file for a project.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Default:</th><td class="field-body"><code class="docutils literal"><span class="pre">{DATADIR}/certs</span></code></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="data">
<dt id="pappyproxy.config.PAPPY_DIR">
<code class="descclassname">pappyproxy.config.</code><code class="descname">PAPPY_DIR</code><a class="headerlink" href="#pappyproxy.config.PAPPY_DIR" title="Permalink to this definition"></a></dt>
<dd><p>The file where pappy&#8217;s scripts are located. Don&#8217;t write anything here, and you
probably don&#8217;t need to write anything here. Use DATA_DIR instead.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Default:</th><td class="field-body">Wherever the scripts are installed</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="data">
<dt id="pappyproxy.config.DATA_DIR">
<code class="descclassname">pappyproxy.config.</code><code class="descname">DATA_DIR</code><a class="headerlink" href="#pappyproxy.config.DATA_DIR" title="Permalink to this definition"></a></dt>
<dd><p>The data directory. This is where files that have to be read by Pappy every time
it&#8217;s run are put. For example, plugins are stored in <code class="docutils literal"><span class="pre">{DATADIR}/plugins</span></code> and
certs are by default stored in <code class="docutils literal"><span class="pre">{DATADIR}/certs</span></code>. This defaults to <code class="docutils literal"><span class="pre">~/.pappy</span></code>
and isn&#8217;t configurable right now.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Default:</th><td class="field-body"><code class="docutils literal"><span class="pre">~/.pappy</span></code></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="data">
<dt id="pappyproxy.config.DATAFILE">
<code class="descclassname">pappyproxy.config.</code><code class="descname">DATAFILE</code><a class="headerlink" href="#pappyproxy.config.DATAFILE" title="Permalink to this definition"></a></dt>
<dd><p>The location of the CA certs that Pappy will use. This can be configured in the
<code class="docutils literal"><span class="pre">config.json</span></code> file for a project.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Default:</th><td class="field-body"><code class="docutils literal"><span class="pre">data.db</span></code></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="data">
<dt id="pappyproxy.config.DEBUG_DIR">
<code class="descclassname">pappyproxy.config.</code><code class="descname">DEBUG_DIR</code><a class="headerlink" href="#pappyproxy.config.DEBUG_DIR" title="Permalink to this definition"></a></dt>
<dd><p>The directory to write debug output to. Don&#8217;t put this outside the project folder
since it writes all the request data to this directory. You probably won&#8217;t need
to use this. Configured in the <code class="docutils literal"><span class="pre">config.json</span></code> file for the project.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Default:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.console">
<span id="pappyproxy-console-module"></span><h2>pappyproxy.console module<a class="headerlink" href="#module-pappyproxy.console" title="Permalink to this headline"></a></h2>
<p>Contains helpers for interacting with the console. Includes definition for the
class that is used to run the console.</p>
<dl class="class">
<dt id="pappyproxy.console.ProxyCmd">
<em class="property">class </em><code class="descclassname">pappyproxy.console.</code><code class="descname">ProxyCmd</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.ProxyCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">cmd2.Cmd</span></code></p>
<p>An object representing the console interface. Provides methods to add
commands and aliases to the console.</p>
<dl class="method">
<dt id="pappyproxy.console.ProxyCmd.add_alias">
<code class="descname">add_alias</code><span class="sig-paren">(</span><em>command</em>, <em>alias</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.ProxyCmd.add_alias" title="Permalink to this definition"></a></dt>
<dd><p>Add an alias for a command.
ie add_alias(&#8220;foo&#8221;, &#8220;f&#8221;) will let you run the &#8216;foo&#8217; command with &#8216;f&#8217;</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.console.ProxyCmd.add_aliases">
<code class="descname">add_aliases</code><span class="sig-paren">(</span><em>alias_list</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.ProxyCmd.add_aliases" title="Permalink to this definition"></a></dt>
<dd><p>Pass in a list of tuples to add them all as aliases.
ie add_aliases([(&#8216;foo&#8217;, &#8216;f&#8217;), (&#8216;foo&#8217;, &#8216;fo&#8217;)]) will add &#8216;f&#8217; and &#8216;fo&#8217; as
aliases for &#8216;foo&#8217;</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.console.ProxyCmd.set_cmd">
<code class="descname">set_cmd</code><span class="sig-paren">(</span><em>command</em>, <em>func</em>, <em>autocomplete_func=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.ProxyCmd.set_cmd" title="Permalink to this definition"></a></dt>
<dd><p>Add a command to the console.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.console.ProxyCmd.set_cmds">
<code class="descname">set_cmds</code><span class="sig-paren">(</span><em>cmd_dict</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.ProxyCmd.set_cmds" title="Permalink to this definition"></a></dt>
<dd><p>Set multiple commands from a dictionary. Format is:
{&#8216;command&#8217;: (do_func, autocomplete_func)}
Use autocomplete_func=None for no autocomplete function</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.console.confirm">
<code class="descclassname">pappyproxy.console.</code><code class="descname">confirm</code><span class="sig-paren">(</span><em>message</em>, <em>default='n'</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.confirm" title="Permalink to this definition"></a></dt>
<dd><p>A helper function to get confirmation from the user. It prints <code class="docutils literal"><span class="pre">message</span></code>
then asks the user to answer yes or no. Returns True if the user answers
yes, otherwise returns False.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.console.load_reqlist">
<code class="descclassname">pappyproxy.console.</code><code class="descname">load_reqlist</code><span class="sig-paren">(</span><em>line</em>, <em>allow_special=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.load_reqlist" title="Permalink to this definition"></a></dt>
<dd><p>A helper function for parsing a list of requests that are passed as an
argument. If <code class="docutils literal"><span class="pre">allow_special</span></code> is True, then it will parse IDs such as
<code class="docutils literal"><span class="pre">u123</span></code> or <code class="docutils literal"><span class="pre">s123</span></code>. Even if allow_special is false, it will still parse
<code class="docutils literal"><span class="pre">m##</span></code> IDs. Will print any errors with loading any of the requests and
will return a list of all the requests which were successfully loaded.
Returns a deferred.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Twisted deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.console.print_requests">
<code class="descclassname">pappyproxy.console.</code><code class="descname">print_requests</code><span class="sig-paren">(</span><em>requests</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.print_requests" title="Permalink to this definition"></a></dt>
<dd><p>Takes in a list of requests and prints a table with data on each of the
requests. It&#8217;s the same table that&#8217;s used by <code class="docutils literal"><span class="pre">ls</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.console.print_table">
<code class="descclassname">pappyproxy.console.</code><code class="descname">print_table</code><span class="sig-paren">(</span><em>coldata</em>, <em>rows</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.console.print_table" title="Permalink to this definition"></a></dt>
<dd><p>Print a table.
Coldata: List of dicts with info on how to print the columns.
<code class="docutils literal"><span class="pre">name</span></code> is the heading to give column,
<code class="docutils literal"><span class="pre">width</span> <span class="pre">(optional)</span></code> maximum width before truncating. 0 for unlimited.</p>
<p>Rows: List of tuples with the data to print</p>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.context">
<span id="pappyproxy-context-module"></span><h2>pappyproxy.context module<a class="headerlink" href="#module-pappyproxy.context" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pappyproxy.context.Context">
<em class="property">class </em><code class="descclassname">pappyproxy.context.</code><code class="descname">Context</code><a class="headerlink" href="#pappyproxy.context.Context" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A class representing a set of requests that pass a set of filters</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first last simple">
<li><strong>active_filters</strong> (List of functions that takes one <a class="reference internal" href="#pappyproxy.http.Request" title="pappyproxy.http.Request"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.http.Request</span></code></a> and returns either true or false.) &#8211; Filters that are currently applied to the context</li>
<li><strong>active_requests</strong> &#8211; Requests which pass all the filters applied to the context</li>
<li><strong>inactive_requests</strong> &#8211; Requests which do not pass all the filters applied to the context</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="pappyproxy.context.Context.add_filter">
<code class="descname">add_filter</code><span class="sig-paren">(</span><em>filt</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Context.add_filter" title="Permalink to this definition"></a></dt>
<dd><p>Add a filter to the context. This will remove any requests that do not pass
the filter from the <code class="docutils literal"><span class="pre">active_requests</span></code> set.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filt</strong> (Function that takes one <a class="reference internal" href="#pappyproxy.http.Request" title="pappyproxy.http.Request"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.http.Request</span></code></a> and returns either true or false. (or a <a class="reference internal" href="#pappyproxy.context.Filter" title="pappyproxy.context.Filter"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.context.Filter</span></code></a>)) &#8211; The filter to add</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.context.Context.add_request">
<code class="descname">add_request</code><span class="sig-paren">(</span><em>req</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Context.add_request" title="Permalink to this definition"></a></dt>
<dd><p>Adds a request to the context. If the request passes all of the context&#8217;s
filters, it will be placed in the <code class="docutils literal"><span class="pre">active_requests</span></code> set. If it does not,
it will be placed in the <code class="docutils literal"><span class="pre">inactive_requests</span></code> set. Either way, it will
be added to <code class="docutils literal"><span class="pre">all_reqs</span></code> and if appropriate, <code class="docutils literal"><span class="pre">in_memory_requests</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>req</strong> (<a class="reference internal" href="#pappyproxy.http.Request" title="pappyproxy.http.Request"><em>Request</em></a>) &#8211; The request to add</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.context.Context.all_reqs">
<code class="descname">all_reqs</code><em class="property"> = set([])</em><a class="headerlink" href="#pappyproxy.context.Context.all_reqs" title="Permalink to this definition"></a></dt>
<dd><p>Class variable! All requests in history. Do not directly add requests to this set. Instead,
use <a class="reference internal" href="#pappyproxy.context.Context.add_request" title="pappyproxy.context.Context.add_request"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.context.Context.add_request()</span></code></a> on some context. It will
automatically be added to this set.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.context.Context.filter_up">
<code class="descname">filter_up</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Context.filter_up" title="Permalink to this definition"></a></dt>
<dd><p>Removes the last filter that was applied to the context.</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.context.Context.in_memory_requests">
<code class="descname">in_memory_requests</code><em class="property"> = set([])</em><a class="headerlink" href="#pappyproxy.context.Context.in_memory_requests" title="Permalink to this definition"></a></dt>
<dd><p>Class variable! Requests that are only stored in memory. These are the requests with <code class="docutils literal"><span class="pre">m##</span></code>
style IDs. Do not directly add requests to this set. Instead, use
<a class="reference internal" href="#pappyproxy.context.Context.add_request" title="pappyproxy.context.Context.add_request"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.context.Context.add_request()</span></code></a> on some context with a request
that has not been saved. It will automatically be assigned a <code class="docutils literal"><span class="pre">m##</span></code> id and
be added to this set.</p>
</dd></dl>
<dl class="staticmethod">
<dt id="pappyproxy.context.Context.remove_request">
<em class="property">static </em><code class="descname">remove_request</code><span class="sig-paren">(</span><em>req</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Context.remove_request" title="Permalink to this definition"></a></dt>
<dd><p>Removes request from all contexts. It is suggested that you use
<a class="reference internal" href="#pappyproxy.http.Request.deep_delete" title="pappyproxy.http.Request.deep_delete"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.Request.deep_delete()</span></code></a> instead as this will
remove the request (and its unmangled version, response, and
unmangled response) from the data file as well. Otherwise it will
just be put back into the context when Pappy is restarted.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>req</strong> (<a class="reference internal" href="#pappyproxy.http.Request" title="pappyproxy.http.Request"><em>Request</em></a>) &#8211; The request to remove</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.context.Context.set_filters">
<code class="descname">set_filters</code><span class="sig-paren">(</span><em>filters</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Context.set_filters" title="Permalink to this definition"></a></dt>
<dd><p>Set the list of filters for the context.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.context.Filter">
<em class="property">class </em><code class="descclassname">pappyproxy.context.</code><code class="descname">Filter</code><span class="sig-paren">(</span><em>filter_string</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Filter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A class representing a filter. Its claim to fame is that you can use
<a class="reference internal" href="#pappyproxy.context.Filter.from_filter_string" title="pappyproxy.context.Filter.from_filter_string"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.context.Filter.from_filter_string()</span></code></a> to generate a
filter from a filter string.</p>
<dl class="staticmethod">
<dt id="pappyproxy.context.Filter.from_filter_string">
<em class="property">static </em><code class="descname">from_filter_string</code><span class="sig-paren">(</span><em>filter_string</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.Filter.from_filter_string" title="Permalink to this definition"></a></dt>
<dd><p>Create a filter from a filter string.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">Deferred that returns a <a class="reference internal" href="#pappyproxy.context.Filter" title="pappyproxy.context.Filter"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.context.Filter</span></code></a></td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.context.async_set_tag">
<code class="descclassname">pappyproxy.context.</code><code class="descname">async_set_tag</code><span class="sig-paren">(</span><em>tag</em>, <em>reqs</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.async_set_tag" title="Permalink to this definition"></a></dt>
<dd><p>Remove the tag from every request then add the given requests to memory and
give them the tag. The async version.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tag</strong> (<em>String</em>) &#8211; The tag to set</li>
<li><strong>reqs</strong> (<em>List of Requests</em>) &#8211; The requests to assign to the tag</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.context.set_tag">
<code class="descclassname">pappyproxy.context.</code><code class="descname">set_tag</code><span class="sig-paren">(</span><em>tag</em>, <em>reqs</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.context.set_tag" title="Permalink to this definition"></a></dt>
<dd><p>Remove the tag from every request then add the given requests to memory and
give them the tag. The non-async version.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tag</strong> (<em>String</em>) &#8211; The tag to set</li>
<li><strong>reqs</strong> (<em>List of Requests</em>) &#8211; The requests to assign to the tag</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.http">
<span id="pappyproxy-http-module"></span><h2>pappyproxy.http module<a class="headerlink" href="#module-pappyproxy.http" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pappyproxy.http.HTTPMessage">
<em class="property">class </em><code class="descclassname">pappyproxy.http.</code><code class="descname">HTTPMessage</code><span class="sig-paren">(</span><em>full_message=None</em>, <em>update_content_length=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A base class which represents an HTTP message. It is used to implement
both requests and responses</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first last simple">
<li><strong>complete</strong> (<a class="reference internal" href="#pappyproxy.http.RepeatableDict" title="pappyproxy.http.RepeatableDict"><em>RepeatableDict</em></a>) &#8211; When loading data with
<a class="reference internal" href="#pappyproxy.http.HTTPMessage.add_line" title="pappyproxy.http.HTTPMessage.add_line"><code class="xref py py-func docutils literal"><span class="pre">add_line()</span></code></a> and
<a class="reference internal" href="#pappyproxy.http.HTTPMessage.add_data" title="pappyproxy.http.HTTPMessage.add_data"><code class="xref py py-func docutils literal"><span class="pre">add_data()</span></code></a>, returns whether the message
is complete</li>
<li><strong>headers</strong> &#8211; Headers of the message</li>
<li><strong>headers_complete</strong> &#8211; When creating the message with
<a class="reference internal" href="#pappyproxy.http.HTTPMessage.add_line" title="pappyproxy.http.HTTPMessage.add_line"><code class="xref py py-func docutils literal"><span class="pre">add_line()</span></code></a> and
<a class="reference internal" href="#pappyproxy.http.HTTPMessage.add_data" title="pappyproxy.http.HTTPMessage.add_data"><code class="xref py py-func docutils literal"><span class="pre">add_data()</span></code></a>, returns whether the headers
are complete</li>
<li><a class="reference internal" href="#pappyproxy.http.Request.start_line" title="pappyproxy.http.Request.start_line"><strong>start_line</strong></a> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; The start line of the message</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.add_data">
<code class="descname">add_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.add_data" title="Permalink to this definition"></a></dt>
<dd><p>Used for building a message from a Twisted protocol.
Add data to the message. The data must conform to the content encoding
and transfer encoding given in the headers passed in to
<a class="reference internal" href="#pappyproxy.http.HTTPMessage.add_line" title="pappyproxy.http.HTTPMessage.add_line"><code class="xref py py-func docutils literal"><span class="pre">add_line()</span></code></a>. Can be any fragment of the data.
I do not suggest that you use this function ever.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; The data to add</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.add_line">
<code class="descname">add_line</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.add_line" title="Permalink to this definition"></a></dt>
<dd><p>Used for building a message from a Twisted protocol.
Add a line (for status line and headers). Lines must be added in order
and the first line must be the status line. The line should not contain
the trailing carriage return/newline. I do not suggest you use this for
anything.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>line</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; The line to add</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.body">
<code class="descname">body</code><a class="headerlink" href="#pappyproxy.http.HTTPMessage.body" title="Permalink to this definition"></a></dt>
<dd><p>The data portion of the message</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the data portion of the message</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Set the data of the response and update metadata</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.body_complete">
<code class="descname">body_complete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.body_complete" title="Permalink to this definition"></a></dt>
<dd><p>Called when the body of the message is complete</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.body_pretty">
<code class="descname">body_pretty</code><a class="headerlink" href="#pappyproxy.http.HTTPMessage.body_pretty" title="Permalink to this definition"></a></dt>
<dd><p>Same thing as <code class="xref py py-func docutils literal"><span class="pre">pappy.http.HTTPMessage.body()</span></code> but the output is
colorized for the terminal.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.copy" title="Permalink to this definition"></a></dt>
<dd><p>Returns a copy of the request</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#pappyproxy.http.Request" title="pappyproxy.http.Request">Request</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.from_json">
<code class="descname">from_json</code><span class="sig-paren">(</span><em>json_string</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.from_json" title="Permalink to this definition"></a></dt>
<dd><p>Update the metadata of the message to match data from
<code class="xref py py-func docutils literal"><span class="pre">to_json()</span></code></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>json_string</strong> (<em>JSON data in a string</em>) &#8211; The JSON data to use</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.full_message">
<code class="descname">full_message</code><a class="headerlink" href="#pappyproxy.http.HTTPMessage.full_message" title="Permalink to this definition"></a></dt>
<dd><p>The full message including the start line, headers, and body</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.full_message_pretty">
<code class="descname">full_message_pretty</code><a class="headerlink" href="#pappyproxy.http.HTTPMessage.full_message_pretty" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#pappyproxy.http.HTTPMessage.full_message" title="pappyproxy.http.HTTPMessage.full_message"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.HTTPMessage.full_message()</span></code></a> except the
output is colorized</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.get_metadata">
<code class="descname">get_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.get_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Get all the metadata of the message in dictionary form.
Should be implemented in child class.
Should not be invoked outside of implementation!</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.handle_header">
<code class="descname">handle_header</code><span class="sig-paren">(</span><em>key</em>, <em>val</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.handle_header" title="Permalink to this definition"></a></dt>
<dd><p>Called when a header is loaded into the message. Should not be called
outside of implementation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>key</strong> &#8211; Header key</li>
<li><strong>key</strong> &#8211; Header value</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.handle_start_line">
<code class="descname">handle_start_line</code><span class="sig-paren">(</span><em>start_line</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.handle_start_line" title="Permalink to this definition"></a></dt>
<dd><p>A handler function for the status line.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.headers_end">
<code class="descname">headers_end</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.headers_end" title="Permalink to this definition"></a></dt>
<dd><p>Called when the headers are complete.</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.headers_section">
<code class="descname">headers_section</code><a class="headerlink" href="#pappyproxy.http.HTTPMessage.headers_section" title="Permalink to this definition"></a></dt>
<dd><p>The raw text of the headers including the extra newline at the end.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the raw text of the headers including the extra newline at the end.</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.headers_section_pretty">
<code class="descname">headers_section_pretty</code><a class="headerlink" href="#pappyproxy.http.HTTPMessage.headers_section_pretty" title="Permalink to this definition"></a></dt>
<dd><p>Same thing as <a class="reference internal" href="#pappyproxy.http.HTTPMessage.headers_section" title="pappyproxy.http.HTTPMessage.headers_section"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.HTTPMessage.headers_section()</span></code></a> except
that the headers are colorized for terminal printing.</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.HTTPMessage.reserved_meta_keys">
<code class="descname">reserved_meta_keys</code><em class="property"> = ['full_message']</em><a class="headerlink" href="#pappyproxy.http.HTTPMessage.reserved_meta_keys" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.reset_metadata">
<code class="descname">reset_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.reset_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Reset meta values to default values. Overridden by child class.
Should not be invoked outside of implementation!</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.set_metadata">
<code class="descname">set_metadata</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.set_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Set metadata values based off of a data dictionary.
Should be implemented in child class.
Should not be invoked outside of implementation!</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; Metadata to apply</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.to_json">
<code class="descname">to_json</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.to_json" title="Permalink to this definition"></a></dt>
<dd><p>Return a JSON encoding of the message that can be used by
<code class="xref py py-func docutils literal"><span class="pre">from_json()</span></code> to recreate the message.
The <code class="docutils literal"><span class="pre">full_message</span></code> portion is base64 encoded because json doesn&#8217;t play
nice with binary blobs.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.update_from_body">
<code class="descname">update_from_body</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.update_from_body" title="Permalink to this definition"></a></dt>
<dd><p>Called when the body of the message is modified directly. Should be used
to update metadata that depends on the body of the message.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.HTTPMessage.update_from_headers">
<code class="descname">update_from_headers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.HTTPMessage.update_from_headers" title="Permalink to this definition"></a></dt>
<dd><p>Called when a header is modified. Should be used to update metadata that
depends on the values of headers.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.http.RepeatableDict">
<em class="property">class </em><code class="descclassname">pappyproxy.http.</code><code class="descname">RepeatableDict</code><span class="sig-paren">(</span><em>from_pairs=None</em>, <em>case_insensitive=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict" title="Permalink to this definition"></a></dt>
<dd><p>A dict that retains the order of items inserted and keeps track of
duplicate values. Can optionally treat keys as case insensitive.
Custom made for the proxy, so it has strange features</p>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.add_pairs">
<code class="descname">add_pairs</code><span class="sig-paren">(</span><em>pairs</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.add_pairs" title="Permalink to this definition"></a></dt>
<dd><p>Add a list of pairs to the dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pairs</strong> (<em>List of tuples of length 2</em>) &#8211; The list of key/value pairs to add</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.all_pairs">
<code class="descname">all_pairs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.all_pairs" title="Permalink to this definition"></a></dt>
<dd><p>A list of all the key/value pairs stored in the dictionary</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.all_vals">
<code class="descname">all_vals</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.all_vals" title="Permalink to this definition"></a></dt>
<dd><p>Return all the values associated with a given key</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.append">
<code class="descname">append</code><span class="sig-paren">(</span><em>key</em>, <em>val</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.append" title="Permalink to this definition"></a></dt>
<dd><p>Append a pair to the end of the dictionary. Will add a duplicate if the key already exists.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.clear">
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.clear" title="Permalink to this definition"></a></dt>
<dd><p>Remove all key/value pairs from the dictionary</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.from_dict">
<code class="descname">from_dict</code><span class="sig-paren">(</span><em>d</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Set the RepeatableDict to contain the same items as a normal dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>d</strong> (<a class="reference external" href="https://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; The dictionary to use</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.set_val">
<code class="descname">set_val</code><span class="sig-paren">(</span><em>key</em>, <em>val</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.set_val" title="Permalink to this definition"></a></dt>
<dd><p>Set a value in the dictionary. Will replace the first instance of the
key with the value. If multiple values of the keys are already in the
dictionary, the duplicates of the key will be removed and the first instance
of the key will be replaced with the value. If the dictionary is case
insensitive, it will maintain the original capitalization. This is the same
behavior as assigning a value via <code class="docutils literal"><span class="pre">d[key]</span> <span class="pre">=</span> <span class="pre">val</span></code>. If the key is not
present, it will be added to the end of the dict.</p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.RepeatableDict.sort">
<code class="descname">sort</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.RepeatableDict.sort" title="Permalink to this definition"></a></dt>
<dd><p>Sort the dictionary by the key. Requires that all keys can be compared
to each other</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.http.Request">
<em class="property">class </em><code class="descclassname">pappyproxy.http.</code><code class="descname">Request</code><span class="sig-paren">(</span><em>full_request=None</em>, <em>update_content_length=True</em>, <em>port=None</em>, <em>is_ssl=None</em>, <em>host=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pappyproxy.http.HTTPMessage" title="pappyproxy.http.HTTPMessage"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.http.HTTPMessage</span></code></a></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first last simple">
<li><strong>time_end</strong> (<a class="reference external" href="https://docs.python.org/library/datetime.html#datetime.datetime" title="(in Python v2.7)"><em>datetime.datetime</em></a>) &#8211; The datetime that the request ended.</li>
<li><strong>time_start</strong> (<a class="reference external" href="https://docs.python.org/library/datetime.html#datetime.datetime" title="(in Python v2.7)"><em>datetime.datetime</em></a>) &#8211; The datetime that the request was made</li>
<li><strong>cookies</strong> (<a class="reference internal" href="#pappyproxy.http.RepeatableDict" title="pappyproxy.http.RepeatableDict"><em>RepeatableDict</em></a>) &#8211; Cookies sent with the request</li>
<li><strong>fragment</strong> (<em>String</em>) &#8211; The fragment part of the url (The part that comes after the #)</li>
<li><strong>url_params</strong> (<a class="reference internal" href="#pappyproxy.http.RepeatableDict" title="pappyproxy.http.RepeatableDict"><em>RepeatableDict</em></a>) &#8211; The url parameters of the request (aka the get parameters)</li>
<li><strong>path</strong> (<em>String</em>) &#8211; The path of the request</li>
<li><strong>port</strong> (<em>Integer</em>) &#8211; The port that the request was sent to (or will be sent to)</li>
<li><strong>post_params</strong> (<a class="reference internal" href="#pappyproxy.http.RepeatableDict" title="pappyproxy.http.RepeatableDict"><em>RepeatableDict</em></a>) &#8211; The post parameters of the request</li>
<li><strong>reqid</strong> (<em>String</em>) &#8211; The request id of the request</li>
<li><strong>response</strong> (<a class="reference internal" href="#pappyproxy.http.Response" title="pappyproxy.http.Response"><em>Response</em></a>) &#8211; The associated response of this request</li>
<li><strong>submitted</strong> (<em>Bool</em>) &#8211; Whether the request has been submitted</li>
<li><strong>unmangled</strong> (<a class="reference internal" href="#pappyproxy.http.Request" title="pappyproxy.http.Request"><em>Request</em></a>) &#8211; If the request was mangled, the version of the request
before it was mangled.</li>
<li><strong>verb</strong> (<em>String</em>) &#8211; The HTTP verb of the request (ie POST, GET)</li>
<li><strong>version</strong> (<em>String</em>) &#8211; The HTTP version of the request (ie HTTP/1.1)</li>
<li><strong>tags</strong> (<em>List of Strings</em>) &#8211; Tags associated with the request</li>
<li><strong>plugin_data</strong> (<em>Dict</em>) &#8211; Data about the request created by plugins. If you modify this, please add your own key to it for your plugin and store all your plugin&#8217;s data under that key (probably as another dict). For example if you have a plugin called <code class="docutils literal"><span class="pre">foo</span></code>, try and store all your data under <code class="docutils literal"><span class="pre">req.plugin_data['foo']</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="pappyproxy.http.Request.async_deep_save">
<code class="descname">async_deep_save</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.async_deep_save" title="Permalink to this definition"></a></dt>
<dd><p>Saves self, unmangled, response, and unmangled response. Returns a deferred
which fires after everything has been saved.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Request.async_save">
<code class="descname">async_save</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.async_save" title="Permalink to this definition"></a></dt>
<dd><p>Save/update the request in the data file. Returns a twisted deferred which
fires when the save is complete.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Request.async_submit">
<code class="descname">async_submit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.async_submit" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#pappyproxy.http.Request.submit" title="pappyproxy.http.Request.submit"><code class="xref py py-func docutils literal"><span class="pre">submit()</span></code></a> but generates deferreds.
Submits the request using its host, port, etc. and updates its response value
to the resulting response.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">Twisted deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Request.deep_delete">
<code class="descname">deep_delete</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.deep_delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete a request, its unmangled version, its response, and its response&#8217;s
unmangled version from history. Also removes the request from all contexts.
Returns a Twisted deferred.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.full_path">
<code class="descname">full_path</code><a class="headerlink" href="#pappyproxy.http.Request.full_path" title="Permalink to this definition"></a></dt>
<dd><p>The full path of the request including URL params and fragment.
ie <cite>/path/to/stuff?foo=bar&amp;baz=something#somewhere</cite></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the full path of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.full_request">
<code class="descname">full_request</code><a class="headerlink" href="#pappyproxy.http.Request.full_request" title="Permalink to this definition"></a></dt>
<dd><p>Alias for Request.full_message</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the full text of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.host">
<code class="descname">host</code><a class="headerlink" href="#pappyproxy.http.Request.host" title="Permalink to this definition"></a></dt>
<dd><p>The host of the request. ie <cite>www.google.com</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the host of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Changes the host of the request and updates the Host header</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.is_ssl">
<code class="descname">is_ssl</code><a class="headerlink" href="#pappyproxy.http.Request.is_ssl" title="Permalink to this definition"></a></dt>
<dd><p>Whether the request is sent over SSL</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns if the request is sent over SSL</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Sets if the request is sent over SSL</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">Bool</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="pappyproxy.http.Request.load_all_requests">
<em class="property">static </em><code class="descname">load_all_requests</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.load_all_requests" title="Permalink to this definition"></a></dt>
<dd><p>Load all the requests in the data file and return them in a list.
Returns a deferred which calls back with the list of requests when complete.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="pappyproxy.http.Request.load_request">
<em class="property">static </em><code class="descname">load_request</code><span class="sig-paren">(</span><em>to_load</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.load_request" title="Permalink to this definition"></a></dt>
<dd><p>Load a request with the given request id and return it.
Returns a deferred which calls back with the request when complete.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="pappyproxy.http.Request.load_requests_by_tag">
<em class="property">static </em><code class="descname">load_requests_by_tag</code><span class="sig-paren">(</span><em>tag</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.load_requests_by_tag" title="Permalink to this definition"></a></dt>
<dd><p>Load all the requests in the data file with a given tag and return them in a list.
Returns a deferred which calls back with the list of requests when complete.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.path_tuple">
<code class="descname">path_tuple</code><a class="headerlink" href="#pappyproxy.http.Request.path_tuple" title="Permalink to this definition"></a></dt>
<dd><p>The path in tuple form starting with the host. For example, path_parts for
a request to <a class="reference external" href="http://www.example.com/foo/bar.php">http://www.example.com/foo/bar.php</a> would be:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="s">&#39;www.example.com&#39;</span><span class="p">,</span> <span class="s">&#39;foo&#39;</span><span class="p">,</span> <span class="s">&#39;bar.php&#39;</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the path in tuple form</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">Tuple</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.raw_data">
<code class="descname">raw_data</code><a class="headerlink" href="#pappyproxy.http.Request.raw_data" title="Permalink to this definition"></a></dt>
<dd><p>Alias for Request.body</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the data portion of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Set the data of the request and update metadata</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.raw_headers">
<code class="descname">raw_headers</code><a class="headerlink" href="#pappyproxy.http.Request.raw_headers" title="Permalink to this definition"></a></dt>
<dd><p>Alias for Request.headers_section</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the raw text of the headers including the extra newline at the end.</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.rsptime">
<code class="descname">rsptime</code><a class="headerlink" href="#pappyproxy.http.Request.rsptime" title="Permalink to this definition"></a></dt>
<dd><p>The response time of the request</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the response time of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">datetime.timedelta</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Request.save">
<code class="descname">save</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.save" title="Permalink to this definition"></a></dt>
<dd><p>Save/update the request in the data file.
Saves the request, its unmangled version, the response, and the unmanbled response.
Cannot be called from inside an async function.</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.saved">
<code class="descname">saved</code><a class="headerlink" href="#pappyproxy.http.Request.saved" title="Permalink to this definition"></a></dt>
<dd><p>If the request is saved in the data file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns True if the request is saved in the data file</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">Bool</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.start_line">
<code class="descname">start_line</code><a class="headerlink" href="#pappyproxy.http.Request.start_line" title="Permalink to this definition"></a></dt>
<dd><p>The status line of the request. ie <cite>GET / HTTP/1.1</cite></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the status line of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Sets the status line of the request</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.status_line">
<code class="descname">status_line</code><a class="headerlink" href="#pappyproxy.http.Request.status_line" title="Permalink to this definition"></a></dt>
<dd><p>Alias for <cite>pappyproxy.http.Request.start_line</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the status line of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Sets the status line of the request</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Request.submit">
<code class="descname">submit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.submit" title="Permalink to this definition"></a></dt>
<dd><p>Submits the request using its host, port, etc. and updates its response value
to the resulting response.
Cannot be called in async functions.
This is what you should use to submit your requests in macros.</p>
</dd></dl>
<dl class="staticmethod">
<dt id="pappyproxy.http.Request.submit_new">
<em class="property">static </em><code class="descname">submit_new</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>is_ssl</em>, <em>full_request</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Request.submit_new" title="Permalink to this definition"></a></dt>
<dd><p>Submits a request with the given parameters and returns a request object
with the response.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>host</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; The host to submit to</li>
<li><strong>port</strong> (<em>Integer</em>) &#8211; The port to submit to</li>
<li><strong>full_request</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) &#8211; The request data to send</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Twisted deferred that calls back with a Request</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Request.url">
<code class="descname">url</code><a class="headerlink" href="#pappyproxy.http.Request.url" title="Permalink to this definition"></a></dt>
<dd><p>The full url of the request including url params, protocol, etc.
ie <cite>https://www.google.com</cite>, <cite>http://foo.fakewebsite.com:1234/path?a=b</cite>.
When setting the URL, the port, is_ssl, path, url params, host, etc are all
automatically updated.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the url of the request</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Sets the url of the request and updates metadata</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.http.Response">
<em class="property">class </em><code class="descclassname">pappyproxy.http.</code><code class="descname">Response</code><span class="sig-paren">(</span><em>full_response=None</em>, <em>update_content_length=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pappyproxy.http.HTTPMessage" title="pappyproxy.http.HTTPMessage"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.http.HTTPMessage</span></code></a></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first last simple">
<li><strong>cookies</strong> (<em>RepeatableDict of ResponseCookie objects</em>) &#8211; Cookies set by the response</li>
<li><strong>response_code</strong> (<em>Integer</em>) &#8211; The response code of the response</li>
<li><strong>response_text</strong> (<em>String</em>) &#8211; The text associated with the response code (ie OK, NOT FOUND, etc)</li>
<li><strong>rspid</strong> (<em>String</em>) &#8211; If the response is saved in the data file, the id of the response</li>
<li><strong>unmangled</strong> (<a class="reference internal" href="#pappyproxy.http.Response" title="pappyproxy.http.Response"><em>Response</em></a>) &#8211; If the response was mangled, the unmangled version of the response</li>
<li><strong>version</strong> (<em>String</em>) &#8211; The version part of the status line (ie HTTP/1.1)</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="pappyproxy.http.Response.add_cookie">
<code class="descname">add_cookie</code><span class="sig-paren">(</span><em>cookie</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response.add_cookie" title="Permalink to this definition"></a></dt>
<dd><p>Add a <a class="reference internal" href="#pappyproxy.http.ResponseCookie" title="pappyproxy.http.ResponseCookie"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.http.ResponseCookie</span></code></a> to the response.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This will add duplicate cookies. If you want to add a cookie you&#8217;re not sure exists,
use <a class="reference internal" href="#pappyproxy.http.Response.set_cookie" title="pappyproxy.http.Response.set_cookie"><code class="xref py py-func docutils literal"><span class="pre">set_cookie()</span></code></a></p>
</div>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Response.async_save">
<code class="descname">async_save</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response.async_save" title="Permalink to this definition"></a></dt>
<dd><p>Save/update the just request in the data file. Returns a twisted deferred which
fires when the save is complete. It is suggested that you use
:func: <cite>~pappyproxy.http.Request.async_deep_save</cite> instead to save responses.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Response.delete_cookie">
<code class="descname">delete_cookie</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response.delete_cookie" title="Permalink to this definition"></a></dt>
<dd><p>Delete a cookie from the response by its key</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Response.full_response">
<code class="descname">full_response</code><a class="headerlink" href="#pappyproxy.http.Response.full_response" title="Permalink to this definition"></a></dt>
<dd><p>The full text of the response including the headers and data.
Alias for Response.full_message</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the full text of the response</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="pappyproxy.http.Response.load_response">
<em class="property">static </em><code class="descname">load_response</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response.load_response" title="Permalink to this definition"></a></dt>
<dd><p>Load a response from its response id. Returns a deferred. I don&#8217;t suggest you use this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">twisted.internet.defer.Deferred</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Response.raw_data">
<code class="descname">raw_data</code><a class="headerlink" href="#pappyproxy.http.Response.raw_data" title="Permalink to this definition"></a></dt>
<dd><p>Alias for Response.body</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the data portion of the response</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Set the data of the response and update metadata</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Response.raw_headers">
<code class="descname">raw_headers</code><a class="headerlink" href="#pappyproxy.http.Response.raw_headers" title="Permalink to this definition"></a></dt>
<dd><p>Alias for Response.headers_section</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the raw text of the headers including the extra newline at the end.</td>
</tr>
<tr class="field-even field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Response.set_cookie">
<code class="descname">set_cookie</code><span class="sig-paren">(</span><em>cookie</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response.set_cookie" title="Permalink to this definition"></a></dt>
<dd><p>Set a cookie in the response. <code class="docutils literal"><span class="pre">cookie</span></code> must be a <a class="reference internal" href="#pappyproxy.http.ResponseCookie" title="pappyproxy.http.ResponseCookie"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.http.ResponseCookie</span></code></a></p>
</dd></dl>
<dl class="method">
<dt id="pappyproxy.http.Response.set_cookie_kv">
<code class="descname">set_cookie_kv</code><span class="sig-paren">(</span><em>key</em>, <em>val</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.Response.set_cookie_kv" title="Permalink to this definition"></a></dt>
<dd><p>Set a cookie by key and value. Will not have path, secure, etc set at all.</p>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Response.soup">
<code class="descname">soup</code><a class="headerlink" href="#pappyproxy.http.Response.soup" title="Permalink to this definition"></a></dt>
<dd><p>Returns a beautifulsoup4 object for parsing the html of the response</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns a BeautifulSoup object representing the html of the response</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pappyproxy.http.Response.start_line">
<code class="descname">start_line</code><a class="headerlink" href="#pappyproxy.http.Response.start_line" title="Permalink to this definition"></a></dt>
<dd><p>The status line of the response. ie <cite>HTTP/1.1 200 OK</cite></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the status line of the response</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Sets the status line of the response</td>
</tr>
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.http.ResponseCookie">
<em class="property">class </em><code class="descclassname">pappyproxy.http.</code><code class="descname">ResponseCookie</code><span class="sig-paren">(</span><em>set_cookie_string=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.ResponseCookie" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A cookie representing a cookie set by a response</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first last simple">
<li><strong>key</strong> &#8211; The key of the cookie</li>
<li><strong>val</strong> &#8211; The value of the cookie</li>
<li><strong>expires</strong> &#8211; The value of the &#8220;expires&#8221; attribute</li>
<li><strong>max_age</strong> &#8211; The max age of the cookie</li>
<li><strong>domain</strong> &#8211; The domain of the cookie</li>
<li><strong>path</strong> &#8211; The path of the cookie</li>
<li><strong>secure</strong> &#8211; The secure flag of the cookie</li>
<li><strong>http_only</strong> &#8211; The httponly flag of the cookie</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="pappyproxy.http.ResponseCookie.cookie_str">
<code class="descname">cookie_str</code><a class="headerlink" href="#pappyproxy.http.ResponseCookie.cookie_str" title="Permalink to this definition"></a></dt>
<dd><p>Returns the full string of the cookie. ie <code class="docutils literal"><span class="pre">foo=bar;</span> <span class="pre">secure;</span> <span class="pre">path=/</span></code></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Getter:</th><td class="field-body">Returns the full string of the cookie.</td>
</tr>
<tr class="field-even field"><th class="field-name">Setter:</th><td class="field-body">Set the metadata from a cookie string. ie from a <code class="docutils literal"><span class="pre">Set-Cookie</span></code> header</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.http.get_request">
<code class="descclassname">pappyproxy.http.</code><code class="descname">get_request</code><span class="sig-paren">(</span><em>url=''</em>, <em>url_params={}</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.get_request" title="Permalink to this definition"></a></dt>
<dd><p>Create a request object that makes a GET request to the given url with the
given url params.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.http.init">
<code class="descclassname">pappyproxy.http.</code><code class="descname">init</code><span class="sig-paren">(</span><em>pool</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.init" title="Permalink to this definition"></a></dt>
<dd><p>Initialize the http module.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pool</strong> (<em>SQLite ConnectionPool</em>) &#8211; The ConnectionPool to use to store the request/response objects</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.http.post_request">
<code class="descclassname">pappyproxy.http.</code><code class="descname">post_request</code><span class="sig-paren">(</span><em>url</em>, <em>post_params={}</em>, <em>url_params={}</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.http.post_request" title="Permalink to this definition"></a></dt>
<dd><p>Create a request object that makes a POST request to the given url with the
given post and url params.</p>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.iter">
<span id="pappyproxy-iter-module"></span><h2>pappyproxy.iter module<a class="headerlink" href="#module-pappyproxy.iter" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pappyproxy.iter.common_passwords">
<code class="descclassname">pappyproxy.iter.</code><code class="descname">common_passwords</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.iter.common_passwords" title="Permalink to this definition"></a></dt>
<dd><p>List common passwords</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.iter.common_usernames">
<code class="descclassname">pappyproxy.iter.</code><code class="descname">common_usernames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.iter.common_usernames" title="Permalink to this definition"></a></dt>
<dd><p>List common usernames</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.iter.fuzz_path_trav">
<code class="descclassname">pappyproxy.iter.</code><code class="descname">fuzz_path_trav</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.iter.fuzz_path_trav" title="Permalink to this definition"></a></dt>
<dd><p>Fuzz common values for path traversal.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.iter.fuzz_sqli">
<code class="descclassname">pappyproxy.iter.</code><code class="descname">fuzz_sqli</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.iter.fuzz_sqli" title="Permalink to this definition"></a></dt>
<dd><p>Fuzz common values that could cause sql errors</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.iter.fuzz_xss">
<code class="descclassname">pappyproxy.iter.</code><code class="descname">fuzz_xss</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.iter.fuzz_xss" title="Permalink to this definition"></a></dt>
<dd><p>Fuzz values for finding XSS</p>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.macros">
<span id="pappyproxy-macros-module"></span><h2>pappyproxy.macros module<a class="headerlink" href="#module-pappyproxy.macros" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pappyproxy.macros.FileInterceptMacro">
<em class="property">class </em><code class="descclassname">pappyproxy.macros.</code><code class="descname">FileInterceptMacro</code><span class="sig-paren">(</span><em>filename=''</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.macros.FileInterceptMacro" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pappyproxy.macros.InterceptMacro" title="pappyproxy.macros.InterceptMacro"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.macros.InterceptMacro</span></code></a></p>
<p>An intercepting macro that loads a macro from a file.</p>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.macros.InterceptMacro">
<em class="property">class </em><code class="descclassname">pappyproxy.macros.</code><code class="descname">InterceptMacro</code><a class="headerlink" href="#pappyproxy.macros.InterceptMacro" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A class representing a macro that modifies requests as they pass through the
proxy</p>
</dd></dl>
<dl class="class">
<dt id="pappyproxy.macros.Macro">
<em class="property">class </em><code class="descclassname">pappyproxy.macros.</code><code class="descname">Macro</code><span class="sig-paren">(</span><em>filename=''</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.macros.Macro" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/functions.html#object" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a></p>
<p>A class representing a macro that can perform a series of requests and add
data to storage.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.macros.load_macros">
<code class="descclassname">pappyproxy.macros.</code><code class="descname">load_macros</code><span class="sig-paren">(</span><em>loc</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.macros.load_macros" title="Permalink to this definition"></a></dt>
<dd><p>Loads the macros stored in the location and returns a list of Macro objects</p>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.pappy">
<span id="pappyproxy-pappy-module"></span><h2>pappyproxy.pappy module<a class="headerlink" href="#module-pappyproxy.pappy" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pappyproxy.plugin">
<span id="pappyproxy-plugin-module"></span><h2>pappyproxy.plugin module<a class="headerlink" href="#module-pappyproxy.plugin" title="Permalink to this headline"></a></h2>
<p>This module contains all the api calls written for use in plugins. If you want
to do anything that is&#8217;t allowed through these function calls or through the
functions provided for macros, contact me and I&#8217;ll see what I can do to add some
more functionality into the next version.</p>
<dl class="function">
<dt id="pappyproxy.plugin.active_intercepting_macros">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">active_intercepting_macros</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.active_intercepting_macros" title="Permalink to this definition"></a></dt>
<dd><p>Returns a list of the active intercepting macro objects. Modifying this list
will not affect which macros are active.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.add_intercepting_macro">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">add_intercepting_macro</code><span class="sig-paren">(</span><em>name</em>, <em>macro</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.add_intercepting_macro" title="Permalink to this definition"></a></dt>
<dd><p>Adds an intercepting macro to the proxy. You can either use a
<a class="reference internal" href="#pappyproxy.macros.FileInterceptMacro" title="pappyproxy.macros.FileInterceptMacro"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.macros.FileInterceptMacro</span></code></a> to load an intercepting macro
from the disk, or you can create your own using an <a class="reference internal" href="#pappyproxy.macros.InterceptMacro" title="pappyproxy.macros.InterceptMacro"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.macros.InterceptMacro</span></code></a>
for a base class. You must give a unique name that will be used in
<a class="reference internal" href="#pappyproxy.plugin.remove_intercepting_macro" title="pappyproxy.plugin.remove_intercepting_macro"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.plugin.remove_intercepting_macro()</span></code></a> to deactivate it. Remember
that activating an intercepting macro will disable request streaming and will
affect performance. So please try and only use this if you may need to modify
messages before they are passed along.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.add_req">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">add_req</code><span class="sig-paren">(</span><em>req</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.add_req" title="Permalink to this definition"></a></dt>
<dd><p>Adds a request to the history. Will not do anything to requests which are
already in history. If the request is not saved, it will be given an m## id.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.all_reqs">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">all_reqs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.all_reqs" title="Permalink to this definition"></a></dt>
<dd><p>Returns a list containing all the requests in history (including requests
that only exist in memory). Modifying this list will not modify requests
included in the history. However, you can edit the requests
in this list then call either <a class="reference internal" href="#pappyproxy.http.Request.save" title="pappyproxy.http.Request.save"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.Request.save()</span></code></a> or
<a class="reference internal" href="#pappyproxy.http.Request.async_save" title="pappyproxy.http.Request.async_save"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.Request.async_save()</span></code></a> to modify the actual request.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.in_memory_reqs">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">in_memory_reqs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.in_memory_reqs" title="Permalink to this definition"></a></dt>
<dd><p>Returns a list containing all out of the requests which exist in memory only
(requests with an m## style id).
You can call either <a class="reference internal" href="#pappyproxy.http.Request.save" title="pappyproxy.http.Request.save"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.Request.save()</span></code></a> or
<a class="reference internal" href="#pappyproxy.http.Request.async_save" title="pappyproxy.http.Request.async_save"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.http.Request.async_save()</span></code></a> to save the request to the data file.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.main_context">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">main_context</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.main_context" title="Permalink to this definition"></a></dt>
<dd><p>Returns the context object representing the main context. Use this to interact
with the context. The returned object can be modified
at will. Avoid modifying any class values (ie all_reqs, in_memory_requests)
and use the class methods to add/remove requests. See the documentation on
<a class="reference internal" href="#pappyproxy.context.Context" title="pappyproxy.context.Context"><code class="xref py py-class docutils literal"><span class="pre">pappyproxy.context.Context</span></code></a> for more information.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.plugin_by_name">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">plugin_by_name</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.plugin_by_name" title="Permalink to this definition"></a></dt>
<dd><p>Returns an interface to access the methods of a plugin from its name.
For example, to call the <code class="docutils literal"><span class="pre">foo</span></code> function from the <code class="docutils literal"><span class="pre">bar</span></code> plugin
you would call <code class="docutils literal"><span class="pre">plugin_by_name('bar').foo()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.remove_intercepting_macro">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">remove_intercepting_macro</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.remove_intercepting_macro" title="Permalink to this definition"></a></dt>
<dd><p>Stops an active intercepting macro. You must pass in the name that you used
when calling <a class="reference internal" href="#pappyproxy.plugin.add_intercepting_macro" title="pappyproxy.plugin.add_intercepting_macro"><code class="xref py py-func docutils literal"><span class="pre">pappyproxy.plugin.add_intercepting_macro()</span></code></a> to identify
which macro you would like to stop.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.plugin.run_cmd">
<code class="descclassname">pappyproxy.plugin.</code><code class="descname">run_cmd</code><span class="sig-paren">(</span><em>cmd</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.plugin.run_cmd" title="Permalink to this definition"></a></dt>
<dd><p>Run a command as if you typed it into the console. Try and use existing APIs
to do what you want before using this.</p>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy.proxy">
<span id="pappyproxy-proxy-module"></span><h2>pappyproxy.proxy module<a class="headerlink" href="#module-pappyproxy.proxy" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pappyproxy.repeater">
<span id="pappyproxy-repeater-module"></span><h2>pappyproxy.repeater module<a class="headerlink" href="#module-pappyproxy.repeater" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pappyproxy.session">
<span id="pappyproxy-session-module"></span><h2>pappyproxy.session module<a class="headerlink" href="#module-pappyproxy.session" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pappyproxy.util">
<span id="pappyproxy-util-module"></span><h2>pappyproxy.util module<a class="headerlink" href="#module-pappyproxy.util" title="Permalink to this headline"></a></h2>
<dl class="exception">
<dt id="pappyproxy.util.PappyException">
<em class="property">exception </em><code class="descclassname">pappyproxy.util.</code><code class="descname">PappyException</code><a class="headerlink" href="#pappyproxy.util.PappyException" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/library/exceptions.html#exceptions.Exception" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></a></p>
<p>The exception class for Pappy. If a plugin command raises one of these, the
message will be printed to the console rather than displaying a traceback.</p>
</dd></dl>
<dl class="function">
<dt id="pappyproxy.util.printable_data">
<code class="descclassname">pappyproxy.util.</code><code class="descname">printable_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#pappyproxy.util.printable_data" title="Permalink to this definition"></a></dt>
<dd><p>Return <code class="docutils literal"><span class="pre">data</span></code>, but replaces unprintable characters with periods.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>String</em>) &#8211; The data to make printable</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">String</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-pappyproxy">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pappyproxy" title="Permalink to this headline"></a></h2>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">pappyproxy package</a><ul>
<li><a class="reference internal" href="#subpackages">Subpackages</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pappyproxy.comm">pappyproxy.comm module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.config">pappyproxy.config module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.console">pappyproxy.console module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.context">pappyproxy.context module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.http">pappyproxy.http module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.iter">pappyproxy.iter module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.macros">pappyproxy.macros module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.pappy">pappyproxy.pappy module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.plugin">pappyproxy.plugin module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.proxy">pappyproxy.proxy module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.repeater">pappyproxy.repeater module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.session">pappyproxy.session module</a></li>
<li><a class="reference internal" href="#module-pappyproxy.util">pappyproxy.util module</a></li>
<li><a class="reference internal" href="#module-pappyproxy">Module contents</a></li>
</ul>
</li>
</ul>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pappyproxy.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Pappy Proxy 0.2.0 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&copy; Copyright 2015, Rob Glew.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
</div>
</body>
</html>