CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Wed, 30 Jul 2025 16:50:56 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20091211103720
location: https://web.archive.org/web/20091211103720/https://code.activestate.com/feeds/tags/python/
server-timing: captures_list;dur=0.590310, exclusion.robots;dur=0.020671, exclusion.robots.policy;dur=0.010498, esindex;dur=0.013598, cdx.remote;dur=422.899451, LoadShardBlock;dur=195.128045, PetaboxLoader3.datanode;dur=86.318975, PetaboxLoader3.resolve;dur=58.680800
x-app-server: wwwb-app212
x-ts: 302
x-tr: 649
server-timing: TR;dur=0,Tw;dur=658,Tc;dur=1
set-cookie: SERVER=wwwb-app212; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Wed, 30 Jul 2025 16:50:59 GMT
content-type: application/atom+xml
content-length: 24836
x-archive-orig-date: Fri, 11 Dec 2009 10:37:18 GMT
x-archive-orig-server: Apache/2.2.3 (CentOS)
x-archive-orig-content-length: 24836
x-archive-orig-expires: Fri, 11 Dec 2009 10:47:18 GMT
x-archive-orig-vary: Cookie
x-archive-orig-last-modified: Fri, 11 Dec 2009 10:37:18 GMT
x-archive-orig-etag: db6f65f48bfdeb3f8c07cec07d645d21
x-archive-orig-cache-control: max-age=600
x-archive-orig-via: 1.0 box19.activestate.com:3129 (squid/2.6.STABLE21)
x-archive-orig-connection: close
cache-control: max-age=1800
x-archive-guessed-content-type: text/xml
x-archive-guessed-charset: utf-8
memento-datetime: Fri, 11 Dec 2009 10:37:20 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Fri, 11 Dec 2009 10:37:20 GMT", ; rel="memento"; datetime="Fri, 11 Dec 2009 10:37:20 GMT", ; rel="last memento"; datetime="Fri, 11 Dec 2009 10:37:20 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_13_20091211091016_crawl103_IndexOnly-c/52_13_20091211103641_crawl103.arc.gz
server-timing: captures_list;dur=0.497197, exclusion.robots;dur=0.016816, exclusion.robots.policy;dur=0.007724, esindex;dur=0.011350, cdx.remote;dur=589.045552, LoadShardBlock;dur=390.449581, PetaboxLoader3.datanode;dur=414.846410, PetaboxLoader3.resolve;dur=506.040605, load_resource;dur=635.993653
x-app-server: wwwb-app212
x-ts: 200
x-tr: 1658
server-timing: TR;dur=0,Tw;dur=839,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
accept-ranges: bytes
ActiveState Code: Recipes tagged with "python" https://code.activestate.com/recipes/tags/python/ 2009-12-10T05:13:24Z Recently added recipes tagged with "python" Authenticated encryption with PyCrypto (Python)
2009-12-10T05:13:24Z Daniel Miller https://ActiveState%20Code/recipes/users/4016391/ https://code.activestate.com/recipes/576980/
<p style="color: grey">
Python
recipe 576980
by <a href="/recipes/users/4016391/">Daniel Miller</a>
(<a href="/recipes/tags/aes/">aes</a>, <a href="/recipes/tags/encrypt/">encrypt</a>, <a href="/recipes/tags/hmac/">hmac</a>, <a href="/recipes/tags/pycrypto/">pycrypto</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>PyCrypto-based authenticated encryption using AES-CBC and HMAC-SHA256. This class only supports shared secret encryption. Look elsewhere for public key encryption.</p>
Twisted Public Deferred (Python)
2009-12-08T09:47:16Z Alan Franzoni https://ActiveState%20Code/recipes/users/4169882/ https://code.activestate.com/recipes/576978/
<p style="color: grey">
Python
recipe 576978
by <a href="/recipes/users/4169882/">Alan Franzoni</a>
(<a href="/recipes/tags/deferred/">deferred</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/twisted/">twisted</a>).
Revision 5.
</p>
<p>This small piece of code helps separating the "public" and "private" interface parts of deferred objects in Twisted.</p>
<p>Although it might not be really useful in production code, it is great for newcomers who are still learning the framework.</p>
Show all url patterns in django (Python)
2009-12-04T10:26:11Z Michael Grünewald https://ActiveState%20Code/recipes/users/4171823/ https://code.activestate.com/recipes/576974/
<p style="color: grey">
Python
recipe 576974
by <a href="/recipes/users/4171823/">Michael Grünewald</a>
(<a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/urls/">urls</a>).
Revision 5.
</p>
<p>This small script shows a simple formatted tree of all defined django url patterns.</p>
JasperServer.cgi. It works (Python)
2009-11-28T10:34:40Z sergio marchenko https://ActiveState%20Code/recipes/users/4172446/ https://code.activestate.com/recipes/576970/
<p style="color: grey">
Python
recipe 576970
by <a href="/recipes/users/4172446/">sergio marchenko</a>
(<a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/jasperreports/">jasperreports</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/snippet/">snippet</a>).
Revision 2.
</p>
<p>running jasperreports over pythons CGI</p>
python jasperreport integration. It is obsolete (Python)
2009-11-28T10:36:21Z sergio marchenko https://ActiveState%20Code/recipes/users/4172446/ https://code.activestate.com/recipes/576969/
<p style="color: grey">
Python
recipe 576969
by <a href="/recipes/users/4172446/">sergio marchenko</a>
(<a href="/recipes/tags/jasperreports/">jasperreports</a>, <a href="/recipes/tags/jasperserver/">jasperserver</a>, <a href="/recipes/tags/jpype/">jpype</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>short python jasperreport integration example</p>
Scrambled word solving game (Python)
2009-12-03T19:48:56Z me me https://ActiveState%20Code/recipes/users/4172371/ https://code.activestate.com/recipes/576963/
<p style="color: grey">
Python
recipe 576963
by <a href="/recipes/users/4172371/">me me</a>
(<a href="/recipes/tags/anagram/">anagram</a>, <a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/word/">word</a>).
Revision 4.
</p>
<p>Solve scrambled words. This game is made by a newbie to python so...</p>
Method-based URL dispatcher for the Tornado web server (Python)
2009-11-20T11:51:47Z Dan McDougall https://ActiveState%20Code/recipes/users/4169722/ https://code.activestate.com/recipes/576958/
<p style="color: grey">
Python
recipe 576958
by <a href="/recipes/users/4169722/">Dan McDougall</a>
(<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/shortcuts/">shortcuts</a>, <a href="/recipes/tags/subclass/">subclass</a>, <a href="/recipes/tags/tornado/">tornado</a>, <a href="/recipes/tags/url/">url</a>, <a href="/recipes/tags/web/">web</a>).
Revision 5.
</p>
<p>The MethodDispatcher is a subclass of <a href="https://www.tornadoweb.org/">tornado</a>.web.RequestHandler that will use
the methods contained in subclasses of MethodDispatcher to handle requests. In
other words, instead of having to make a new RequestHandler class for every URL
in your application you can subclass MethodDispatcher and use the methods
contained therein <em>as</em> your URLs.</p>
<p>The MethodDispatcher also adds the convenience of automatically passing
arguments to your class methods. So there is no need to use Tornado's
get_argument() method.</p>
<h5><strong>Example</strong></h5>
<p>To demonstrate the advantages of using MethodDispatcher I'll present a standard
Tornado app with multiple URLs and re-write it using MethodDispatcher...</p>
<h5><strong>The standard Tornado way</strong></h5>
<pre><code>class Foo(tornado.web.RequestHandler):
def get(self):
self.write('foo')
class Bar(tornado.web.RequestHandler):
def get(self):
self.write('bar')
class SimonSays(tornado.web.RequestHandler):
def get(self):
say = self.get_argument("say")
self.write('Simon says, %s' % `say`)
application = tornado.web.Application([
(r"/foo", Foo),
(r"/bar", Bar),
(r"/simonsays", SimonSays),
])
</code></pre>
<h5><strong>The MethodDispatcher way</strong></h5>
<pre><code>class FooBar(MethodDispatcher):
def foo(self):
self.write("foo")
def bar(self):
self.write("bar")
def simonsays(self, say):
self.write("Simon Says, %s" % `say`)
application = tornado.web.Application([
(r"/.*", FooBar)
])
</code></pre>
<h5><strong>Notes</strong></h5>
<p>As you can see from the above example, using the MethodDispatcher can
significantly reduce the complexity of Tornado applications. Here's some other
things to keep in mind when using the MethodDispatcher:</p>
<ul>
<li>MethodDispatcher will ignore any methods that begin with an underscore (_).
This prevents builtins and private methods from being exposed to the web.</li>
<li>The '/' path is special: It always maps to self.index().</li>
<li>MethodDispatcher does not require that your methods distinquish between GET
and POST requests. Whether a GET or POST is performed the matching method
will be called with any passed arguments or POSTed data. Because of the way
this works you should not use get() and post() in your MethodDispatcher
subclasses unless you want to override this functionality.</li>
<li>When an argument is passed with a single value (/simonsays?say=hello) the
value passed to the argument will be de-listed. In other words, it will be
passed to your method like so: {'say': 'hello'}. This overrides the
default Tornado behavior which would return the value as a list:
{'say': ['hello']}. If more than one value is passed MethodDispatcher will
use the default behavior.</li>
</ul>
Run async code inline, nonblocking (Python)
2009-11-11T12:55:01Z Thomas Ahle https://ActiveState%20Code/recipes/users/4060075/ https://code.activestate.com/recipes/576952/
<p style="color: grey">
Python
recipe 576952
by <a href="/recipes/users/4060075/">Thomas Ahle</a>
(<a href="/recipes/tags/asynchronous/">asynchronous</a>, <a href="/recipes/tags/closure/">closure</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/threads/">threads</a>).
Revision 7.
</p>
<p>A decorator, that makes it easy to switch between the mainthread and background threads.</p>
Simple, if naive, class factory recipe in python (Python)
2009-11-09T07:59:53Z Ariel Balter https://ActiveState%20Code/recipes/users/4172249/ https://code.activestate.com/recipes/576951/
<p style="color: grey">
Python
recipe 576951
by <a href="/recipes/users/4172249/">Ariel Balter</a>
(<a href="/recipes/tags/class factory/">class factory</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>I'm a hack programmer -- no formal education. So, I don't know if this is technically a "factory", "abstract factory" or something else.</p>
<p>It is a way to generate a class dynamically, perhaps based on run-time data.</p>
<p>The point is that you can take a blank class object and dynamically add a constructor, class attributes, and instance methods. In principle, these could be configured dynamically in a program.</p>
<p>Since I don't know anything about programming theory, I welcome any criticism/discussion/suggestion. But, please be gentle!</p>
Planet Terrain Heightmap Generator (Python)
2009-10-13T17:37:45Z Shea Kauffman https://ActiveState%20Code/recipes/users/4168682/ https://code.activestate.com/recipes/576929/
<p style="color: grey">
Python
recipe 576929
by <a href="/recipes/users/4168682/">Shea Kauffman</a>
(<a href="/recipes/tags/generaation/">generaation</a>, <a href="/recipes/tags/heightmap/">heightmap</a>, <a href="/recipes/tags/landscape/">landscape</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/planet/">planet</a>, <a href="/recipes/tags/planted/">planted</a>, <a href="/recipes/tags/pygame/">pygame</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/terrain/">terrain</a>, <a href="/recipes/tags/world creation/">world creation</a>).
Revision 5.
</p>
<p>The process is simply:
1. Take a plane
2. Cut out a shape
3. Make it a little taller
4. Repeat</p>
<ul>
<li>Similar to the <a href="https://freespace.virgin.net/hugo.elias/models/m_landsp.htm">spherical landscape</a> algorithm by Hugo Elias.</li>
<li>I found a combination of Ovals and Triangles to produce the best results.</li>
</ul>
Caller and Callee (Python)
2009-10-19T11:29:21Z Michael Grünewald https://ActiveState%20Code/recipes/users/4171823/ https://code.activestate.com/recipes/576925/
<p style="color: grey">
Python
recipe 576925
by <a href="/recipes/users/4171823/">Michael Grünewald</a>
(<a href="/recipes/tags/callee/">callee</a>, <a href="/recipes/tags/caller/">caller</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/python/">python</a>).
Revision 4.
</p>
<p>A recipe to find out which function is the caller of the current function.</p>
Python RGB and HSV Conversion (Python)
2009-10-01T06:33:56Z Michael Fogleman https://ActiveState%20Code/recipes/users/4171845/ https://code.activestate.com/recipes/576919/
<p style="color: grey">
Python
recipe 576919
by <a href="/recipes/users/4171845/">Michael Fogleman</a>
(<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/hsv/">hsv</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/rgb/">rgb</a>).
</p>
<p>Python code to convert RGB to HSV and vice-versa.</p>
Python Short URL Generator (Python)
2009-09-30T08:01:06Z Michael Fogleman https://ActiveState%20Code/recipes/users/4171845/ https://code.activestate.com/recipes/576918/
<p style="color: grey">
Python
recipe 576918
by <a href="/recipes/users/4171845/">Michael Fogleman</a>
(<a href="/recipes/tags/deterministic/">deterministic</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/short/">short</a>, <a href="/recipes/tags/tiny/">tiny</a>, <a href="/recipes/tags/unique/">unique</a>, <a href="/recipes/tags/url/">url</a>).
</p>
<p>Python implementation for generating Tiny URL- and bit.ly-like URLs.</p>
XXX: Obsolete Recipe (Python)
2009-09-22T12:49:13Z Stephen Chappell https://ActiveState%20Code/recipes/users/2608421/ https://code.activestate.com/recipes/576901/
<p style="color: grey">
Python
recipe 576901
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/2D/">2D</a>, <a href="/recipes/tags/fast/">fast</a>, <a href="/recipes/tags/point/">point</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/Python 3.0/">Python 3.0</a>, <a href="/recipes/tags/Python 3.1/">Python 3.1</a>, <a href="/recipes/tags/vector/">vector</a>).
Revision 10.
</p>
<p>Deleted after being replaced with a better recipe with RFC.</p>
Convert datetime in python to user friendly representation. (Python)
2009-08-15T01:00:03Z Jai Vikram Singh Verma https://ActiveState%20Code/recipes/users/4171450/ https://code.activestate.com/recipes/576880/
<p style="color: grey">
Python
recipe 576880
by <a href="/recipes/users/4171450/">Jai Vikram Singh Verma</a>
(<a href="/recipes/tags/ago/">ago</a>, <a href="/recipes/tags/datetime/">datetime</a>, <a href="/recipes/tags/parse/">parse</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/representation/">representation</a>, <a href="/recipes/tags/string/">string</a>, <a href="/recipes/tags/user-friendly/">user-friendly</a>).
</p>
<p>A small contribution to the developer community.</p>
<p>This module caters to the need of developers who want to put date & time of post in terms like <br />
"X days, Y hrs ago", "A hours B mins ago", etc. in their applications rather then a basic timestamp <br />
like "2009-08-15 03:03:00". Additionally it also <br />
provides since epoch for a given datetime. </p>
<p>It takes in a Python datetime object as an input <br />
and provides a fancy datetime (as I call it) and <br />
the seconds since epoch. </p>
Exception handling in a single line (Python)
2009-10-09T01:07:52Z Radek Szklarczyk https://ActiveState%20Code/recipes/users/2847011/ https://code.activestate.com/recipes/576872/
<p style="color: grey">
Python
recipe 576872
by <a href="/recipes/users/2847011/">Radek Szklarczyk</a>
(<a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/expression/">expression</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/list comprehension/">list comprehension</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/wrapper/">wrapper</a>).
Revision 16.
</p>
<p>The rules of <em>duck typing</em> in python encourage programmers to use the "try...except..." clause. At the same time python with new versions enables to use more powerful list comprehensions (for example Conditional Expressions). However, it is impossible to write the "try...except..." clause in a list comprehension. The following recipe "protects" a function against exception and returns a default value in the case when exception is thrown.</p>
port-alldeps: list all dependencies of Macports packages (Python)
2009-08-05T09:14:02Z denis https://ActiveState%20Code/recipes/users/4168005/ https://code.activestate.com/recipes/576868/
<p style="color: grey">
Python
recipe 576868
by <a href="/recipes/users/4168005/">denis</a>
(<a href="/recipes/tags/Macports/">Macports</a>, <a href="/recipes/tags/package dependency graph/">package dependency graph</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>port-alldeps package ... <br />
lists all dependencies of Macports packages -- 1st 2nd 3rd level ... <br />
by repeatedly calling "port deps".</p>
CGI doc string reader (Python)
2009-10-24T14:18:56Z Timothy Makobu https://ActiveState%20Code/recipes/users/4165901/ https://code.activestate.com/recipes/576850/
<p style="color: grey">
Python
recipe 576850
by <a href="/recipes/users/4165901/">Timothy Makobu</a>
(<a href="/recipes/tags/dosctring/">dosctring</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python developer tools/">python developer tools</a>).
Revision 9.
</p>
<p>Displays docstrings of attributes of the given Python module on a web browser.
Drop it into the cgi-bin of your web-server, and access it like this,
for example:</p>
<p><a href="https://localhost/cgi-bin/cgidir.py?m=socket" rel="nofollow">https://localhost/cgi-bin/cgidir.py?m=socket</a></p>
firefox sqlite files cleaner (linux) (Python)
2009-07-15T12:15:20Z Vince Spicer https://ActiveState%20Code/recipes/users/4171124/ https://code.activestate.com/recipes/576843/
<p style="color: grey">
Python
recipe 576843
by <a href="/recipes/users/4171124/">Vince Spicer</a>
(<a href="/recipes/tags/firefox/">firefox</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
Revision 3.
</p>
<p>Modified from <a href="https://code.activestate.com/recipes/576842/">Recipe 576842</a> to support linux</p>
<p>Walks through the all the Firefox profiles in current user account and cleans all *.sqlite files with "vacuum". It makes firefox faster then often. </p>
<p>tested on Ubuntu</p>
<p>For: python 2.6 (2.5+sqlite3), FF 3.5</p>
firefox sqlite files cleaner (Python)
2009-07-18T21:41:13Z geon . https://ActiveState%20Code/recipes/users/2919471/ https://code.activestate.com/recipes/576842/
<p style="color: grey">
Python
recipe 576842
by <a href="/recipes/users/2919471/">geon .</a>
(<a href="/recipes/tags/firefox/">firefox</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
Revision 7.
</p>
<p>Walks through the all the Firefox profiles in current user account and cleans all
*.sqlite files with "vacuum". It makes firefox faster then often. Should work on Linux, too, when properly changed constants.</p>
<p>For: python 2.6 (2.5+sqlite3), FF 3.5</p>