Popular recipes tagged "meta:requires=cookielib" and "web"http://code.activestate.com/recipes/tags/meta:requires=cookielib+web/2008-05-15T01:09:08-07:00ActiveState Code RecipesWeb browser emulator (Python)
2008-05-15T01:09:08-07:00Laszlo Nagyhttp://code.activestate.com/recipes/users/4150221/http://code.activestate.com/recipes/572202-web-browser-emulator/
<p style="color: grey">
Python
recipe 572202
by <a href="/recipes/users/4150221/">Laszlo Nagy</a>
(<a href="/recipes/tags/web/">web</a>).
</p>
<p>Objects of the MozillaEmulator class can emulate a browser that is capable of:</p>
<ul>
<li>cookie management</li>
<li>caching</li>
<li>configurable user agent string</li>
<li>GET and POST</li>
<li>multipart POST (send files)</li>
<li>receive content into file</li>
<li>progress indicator</li>
</ul>
xmlrpc server/client which does cookie handling and supports basic authentication (Python)
2007-01-23T10:51:39-08:00Vaibhav Bhatiahttp://code.activestate.com/recipes/users/4007166/http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/
<p style="color: grey">
Python
recipe 501148
by <a href="/recipes/users/4007166/">Vaibhav Bhatia</a>
(<a href="/recipes/tags/web/">web</a>).
</p>
<p>xmlrpc server client which do the following:
* client sends a request with basic authentication
* server on successful authentication sends response back and also sends cookies with authentication id
* these cookies are saved by client and then used for authentication on any subsequent requests</p>
cookielib Example (Python)
2004-12-28T11:26:41-08:00Michael Foordhttp://code.activestate.com/recipes/users/1565518/http://code.activestate.com/recipes/302930-cookielib-example/
<p style="color: grey">
Python
recipe 302930
by <a href="/recipes/users/1565518/">Michael Foord</a>
(<a href="/recipes/tags/web/">web</a>).
Revision 2.
</p>
<p>cookielib is a library new to Python 2.4
Prior to Python 2.4 it existed as ClientCookie, but it's not a drop in replacement - some of the function of ClientCookie has been moved into urllib2.</p>
<p>This example shows code for fetching URIs (with cookie handling - including loading and saving) that will work unchanged on :
a machine with python 2.4 (and cookielib)
a machine with ClientCookie installed
a machine with neither
(Obviously on the machine with neither the cookies won't be handled or saved).</p>
<p>Where either cookielib or ClientCookie is available the cookies will be saved in a file.
If that file exists already the cookies will first be loaded from it.
The file format is a useful plain text format and the attributes of each cookie is accessible in the Cookiejar instance (once loaded).</p>
<p>This may be helpful to those just using ClientCookie as the ClientCookie documentation doesn't appear to document the LWPCookieJar class which is needed for saving and loading cookies.</p>