Package httxlib :: Module httxcookiejar :: Class HttxCookieJar
[hide private]
[frames] | no frames]

Class HttxCookieJar

source code

           object --+    
                    |    
httxobject.HttxObject --+
                        |
                       HttxCookieJar

An CookieJar holder to enable deepcopy semantics with locking.

CookieJars already lock access to the internals, but cannot be deepcopied, which prevents separation of cookiejars into different domains as achieved with different HttxOptions

A light wrapper over CookieJar with a lock for deepcopy and access to the internal variable _cookies is needed to achieve deepcopy and therefore enable separation of domains

Instance Methods [hide private]
 
__init__(self)
Constructor.
source code
HttxCookieJar
__deepcopy__(self, memo)
Deepcopy support.
source code
 
add_cookie_header(self, request)
Add a cookie header to the request if needed
source code
 
extract_cookies(self, response, request)
Extract cookies from the response, using request as a basis to do so
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
urllib2 CookieJar cookiejar
CookieJar object holding the cookies

Inherited from httxobject.HttxObject: lock

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Constructor. It delegates construction to the base class HttxObject and initializes the member variables

Overrides: object.__init__

__deepcopy__(self, memo)

source code 

Deepcopy support.

The lock prevents access from any other part of the library to this CookieJar, enabling a deepcopy of the private variable into the private variable of the clone to enable separation of domains for CookieJar objects

The existing RLock in the CookieJar objects forbids direct deepcopy

Parameters:
  • memo (dict) - standard __deepcopy__ parameter to avoid circular references
Returns: HttxCookieJar
a cloned object

add_cookie_header(self, request)

source code 

Add a cookie header to the request if needed

This is a simple stub for CookieJar add_cookie_header

Parameters:
  • request (urllib2 compatible Request - HttxRequest) - the request to be manipulated

extract_cookies(self, response, request)

source code 

Extract cookies from the response, using request as a basis to do so

This is a simple stub for CookieJar extract_cookies

Parameters:
  • response (urllib2 compatible Response - HttxResponse) - the response containing the headers where cookies may be present
  • request (urllib2 compatible Request - HttxRequest) - the request to be manipulated