| Server IP : 20.75.53.88 / Your IP : 216.73.217.72 [ Web Server : Apache System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29+esm15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Domains : 3 Domains MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/usr/share/doc/python-twisted-web/examples/ |
Upload File : |
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Twisted Documentation: Twisted Web code examples</title>
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body bgcolor="white">
<h1 class="title">Twisted Web code examples</h1>
<div class="toc"><ol><li><a href="#auto0">twisted.web.client</a></li><li><a href="#auto1">XML-RPC</a></li><li><a href="#auto2">Virtual hosts and proxies</a></li><li><a href="#auto3">.rpys and ResourceTemplate</a></li><li><a href="#auto4">Miscellaneous</a></li></ol></div>
<div class="content">
<span/>
<h2>twisted.web.client<a name="auto0"/></h2>
<ul>
<li><a href="getpage.py" shape="rect">getpage.py</a> - use
<code>twisted.web.client.getPage</code> to download a web
page.</li>
<li><a href="dlpage.py" shape="rect">dlpage.py</a> - add callbacks to
<code>twisted.web.client.downloadPage</code> to display errors
that occur when downloading a web page</li>
</ul>
<h2>XML-RPC<a name="auto1"/></h2>
<ul>
<li><a href="xmlrpc.py" shape="rect">xmlrpc.py</a> XML-RPC server with
several methods, including echoing, faulting, returning
deferreds and failed deferreds</li>
<li><a href="xmlrpcclient.py" shape="rect">xmlrpcclient.py</a> - use
<code>twisted.web.xmlrpc.Proxy</code> to call remote XML-RPC
methods</li>
<li><a href="advogato.py" shape="rect">advogato.py</a> - use
<code>twisted.web.xmlrpc</code> to post a diary entry to
advogato.org; requires an advogato account</li>
</ul>
<h2>Virtual hosts and proxies<a name="auto2"/></h2>
<ul>
<li><a href="proxy.py" shape="rect">proxy.py</a> -
use <code>twisted.web.proxy.Proxy</code> to make the simplest
proxy</li>
<li><a href="logging-proxy.py" shape="rect">logging-proxy.py</a> - example of
subclassing the core classes of <code>twisted.web.proxy</code>
to log requests through a proxy</li>
<li><a href="reverse-proxy.py" shape="rect">reverse-proxy.py</a> - use
<code>twisted.web.proxy.ReverseProxyResource</code> to make
any HTTP request to the proxy port get applied to a specified
website</li>
<li><a href="rootscript.py" shape="rect">rootscript.py</a> - example use of
<code>twisted.web.vhost.NameVirtualHost</code></li>
<li><a href="web.py" shape="rect">web.py</a> - an example of both using the
<code>processors</code> attribute to set how certain file types
are treated and using
<code>twisted.web.vhost.VHostMonsterResource</code> to reverse
proxy</li>
</ul>
<h2>.rpys and ResourceTemplate<a name="auto3"/></h2>
<ul>
<li><a href="hello.rpy.py" shape="rect">hello.rpy.py</a> - use
<code>twisted.web.static</code> to create a static resource to
serve</li>
<li><a href="fortune.rpy.py" shape="rect">fortune.rpy.py</a> - create a
resource that returns the output of a process run on the
server</li>
<li><a href="lj.rpy.py" shape="rect">lj.rpy.py</a> - use
<code>twisted.web.microdom</code>,
<code>twisted.web.domhelpers</code>, and chained callbacks to
extract and display parts of a livejournal user's rss page</li>
<li><a href="report.rpy.py" shape="rect">report.rpy.py</a> - display
various properties of a resource, including path, host, and
port</li>
<li><a href="users.rpy.py" shape="rect">users.rpy.py</a> - use
<code>twisted.web.distrib</code> to publish user directories
as for a "community web site"</li>
<li><a href="simple.rtl" shape="rect">simple.rtl</a> - example use of
<code>twisted.web.resource.ResourceTemplate</code></li>
</ul>
<h2>Miscellaneous<a name="auto4"/></h2>
<ul>
<li><a href="webguard.py" shape="rect">webguard.py</a> - pairing
<code>twisted.web</code> with <code>twisted.cred</code> to
guard resources against unauthenticated users</li>
<li><a href="silly-web.py" shape="rect">silly-web.py</a> - bare-bones
distributed web setup with a master and slave using
<code>twisted.web.distrib</code> and
<code>twisted.spread.pb</code></li>
<li><a href="soap.py" shape="rect">soap.py</a> - use
<code>twisted.web.soap</code> to publish SOAP methods</li>
</ul>
</div>
<p><a href="../howto/index.html">Index</a></p>
<span class="version">Version: 13.2.0</span>
</body>
</html>