cookielib Example

Category: Python - Miscellaneous

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.

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).

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).

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. Date: 22 February, 2012


Web

Homepage: http://code.activestate.com/recipes/302930-cookielib-example/?in=lang-python

Developer: Michael Foord

License: Python License

Operating System: Windows

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

XOOPS is a dynamic OO (Object Oriented) based open source portal script written in PHP.

developer Developer: http://www.xoops.org
license License: Freeware
operating systems Operating System: win, linux, unix, etc


MaxWebPortal is a web portal and online community system which includes advanced features such as web-based administration, poll, private/public events calendar, user customizable color themes, classifieds, user control panel, online pager, link, file, article, picture managers and much more.

developer Developer: http://www.maxwebportal....
license License: Freeware
operating systems Operating System: Win 95/98/ME/2000/XP, Access 97/2000, SQL


HTML::Mason is a web site development and delivery system that constructs web pages and sites from shared, reusable building blocks called components.

developer Developer: Mason Team
license License: GNU General Public License (GPL)
operating systems Operating System: Apache


Super-dot.

developer Developer: Robert
license License: Unknown
operating systems Operating System: Not Available


Provides Slackware web hosting, shell accounts and domain registration.

developer Developer: CretaForce
license License: Unknown
operating systems Operating System: Not Available


Amdac Systems has been setting new standards in web hosting, software development, and marketing solutions since 2002.

developer Developer: Dave
license License: Unknown
operating systems Operating System: Not Available


We offer $1 Cheap, Free Setup, Reliable, Unlimited Domains Reseller/Shared Hosting.

developer Developer: Sonia
license License: Unknown
operating systems Operating System: Not Available


Another way to read lines from file backwards from the end to the beginning.

developer Developer: Andrew Dalke
license License: Python License
operating systems Operating System: Windows


Below you will find a simple python class that I wrote to test performance of
various different sorting techniques.

developer Developer: John Nielsen
license License: Python License
operating systems Operating System: Windows