Latest recipes tagged "proxy"http://code.activestate.com/recipes/tags/proxy/new/2013-07-18T10:02:59-07:00ActiveState Code RecipesExtending non-extendable C++ based Python classes (Python) 2013-07-18T10:02:59-07:00Ahmet Emre Aladağhttp://code.activestate.com/recipes/users/4174877/http://code.activestate.com/recipes/578576-extending-non-extendable-c-based-python-classes/ <p style="color: grey"> Python recipe 578576 by <a href="/recipes/users/4174877/">Ahmet Emre Aladağ</a> (<a href="/recipes/tags/attribute/">attribute</a>, <a href="/recipes/tags/proxy/">proxy</a>, <a href="/recipes/tags/subclass/">subclass</a>). Revision 2. </p> <p>graph_tool library is based on boost C++ library and provides Vertex class binding for Python. If we wanted to extend this Vertex class and add some attributes and methods, it wouldn't let us do that due to private constructor in C++ code (RuntimeError: This class cannot be instantiated from Python). We can overcome this obstacle using Proxy pattern.</p> <p>In the __getattr__ method, if the attribute(or function name) is not in the Subclass MyVertex, then it looks for attributes of Vertex object that is defined inside MyVertex.</p> Method access counter proxy (Python) 2011-09-18T12:49:15-07:00Yaşar Arabacıhttp://code.activestate.com/recipes/users/4178739/http://code.activestate.com/recipes/577869-method-access-counter-proxy/ <p style="color: grey"> Python recipe 577869 by <a href="/recipes/users/4178739/">Yaşar Arabacı</a> (<a href="/recipes/tags/proxy/">proxy</a>). Revision 4. </p> <p>This function creates a proxy for a class so that you can count how many times each method called. It only works for mutable types.</p> Transparent HTTP Tunnel for Python sockets (to be used by ftplib ) (Python) 2011-11-07T10:25:56-08:00Raphaël Jolivethttp://code.activestate.com/recipes/users/4135673/http://code.activestate.com/recipes/577643-transparent-http-tunnel-for-python-sockets-to-be-u/ <p style="color: grey"> Python recipe 577643 by <a href="/recipes/users/4135673/">Raphaël Jolivet</a> (<a href="/recipes/tags/ftp/">ftp</a>, <a href="/recipes/tags/ftplib/">ftplib</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/over/">over</a>, <a href="/recipes/tags/proxy/">proxy</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/socket/">socket</a>, <a href="/recipes/tags/socks/">socks</a>). Revision 4. </p> <p>This script allows how to transparently install a HTTP proxy (proxy HTTP 1.1, using CONNECT command) on all outgoing sockets.</p> <p>I did that to bring TCP over HTTP to FTPlib, transparently. It should enable HTTP tunneling for all methods / modules that use the low-level socket API.</p> Multi threaded SMTP proxy (Python) 2010-06-12T22:27:00-07:00Lobsanghttp://code.activestate.com/recipes/users/4174176/http://code.activestate.com/recipes/577260-multi-threaded-smtp-proxy/ <p style="color: grey"> Python recipe 577260 by <a href="/recipes/users/4174176/">Lobsang</a> (<a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/proxy/">proxy</a>, <a href="/recipes/tags/smtp/">smtp</a>). Revision 2. </p> <p>This smtp proxy can be used to process any part of the message (header and body). It is also possible to process all the body part just before it is send to the MTA.</p> <p>The aim of this proxy is to allow a modification of the message on the fly. It had been tested with the postfix <a href="http://www.postfix.org/SMTPD_PROXY_README.html">before queue content filter</a></p>