Package httxlib :: Module httxmanager :: Class HttxManager
[hide private]
[frames] | no frames]

Class HttxManager

source code

           object --+        
                    |        
httxobject.HttxObject --+    
                        |    
        httxbase.HttxBase --+
                            |
                           HttxManager

Main HttxLib Connecting object. The HttxManager is responsible for creating and managing a set of HttxNetLocation (net locations) objects that will in turn hold the actual connections.

The net location objects will be created on demand and kept in storage. A reference to active netlocations, (those with a pending getresponse after a request) will also be stored in a cache.

Instance Methods [hide private]
 
__init__(self, **kwargs)
Constructor.
source code
HttxManager @see clone
__deepcopy__(self, memo)
Deepcopy support.
source code
HttxManager
clone(self, options=None, netLocations=True)
Clone the object using the supplied options or a new set of options if given.
source code
 
setproxydefaults(self)
Set the proxy options from OS defaults or environment variables if present using the functionality preset in urllib
source code
 
setproxy(self, proxy=None)
Set the proxy options by opening specific netlocations for http and/or https schemes The proxy can be different for http and https connections.
source code
HttxNetLocation
_getnetlocation(self, httxreq)
Internal interface to fetch the appropiate HttxNetLocation net location object to use to issue a request as specified by httxreq
source code
opaque type for the caller (a Python sock)
request(self, httxreq)
Send the HttxRequest httxreq to the specified server inside the request
source code
HttxResponse (compatible with httplib HTTPResponse)
getresponse(self, sock)
Recover a HttxResponse using a net location from the cache of active HttxNetLocation net locations and calling its getresponse
source code

Inherited from httxbase.HttxBase: add_ca_cert, add_cert_req, add_certkey, add_password, setdecompmethods, setoptions, setuseragent, urlopen

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

Instance Variables [hide private]
HttxOptions options
The shared options for the connection(s)

Inherited from httxobject.HttxObject: lock

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 

Constructor. It delegates construction to the base class HttxBase, except for the proxy that will be set specifically

Setting the proxy ensures the initialization of the storage of netlocations and the cache of active netlocations

Parameters:
  • kwargs - keywords arguments
Overrides: object.__init__

See Also: HttxOptions

__deepcopy__(self, memo)

source code 

Deepcopy support.

Parameters:
  • memo (dict) - standard __deepcopy__ parameter to avoid circular references
Returns: HttxManager @see clone
cloned object

clone(self, options=None, netLocations=True)

source code 

Clone the object using the supplied options or a new set of options if given.

An equivalente set of HttxNetLocation net locations will be replicated

A new set of options will separate the clone object from the original object, since they will no longer share cookies, user/password/realm combinations or https certificates

Parameters:
  • options (HttxOptions) - options for the cloned object
  • netLocations (bool) - whether to clone the existing netlocations
Returns: HttxManager
cloned object

setproxy(self, proxy=None)

source code 

Set the proxy options by opening specific netlocations for http and/or https schemes The proxy can be different for http and https connections.

The HttxNetLocation net locations storage and cache of active net locations are initialized

Parameters:
  • proxy (dict) - proxy servers. Dictionary with scheme:url pairs. '*' or 'httx' as the scheme stands for both http and https
Overrides: httxbase.HttxBase.setproxy

_getnetlocation(self, httxreq)

source code 

Internal interface to fetch the appropiate HttxNetLocation net location object to use to issue a request as specified by httxreq

Parameters:
Returns: HttxNetLocation
httxnetlocation

request(self, httxreq)

source code 

Send the HttxRequest httxreq to the specified server inside the request

Parameters:
  • httxreq (HttxRequest or url (string)) - Request or url to be executed
Returns: opaque type for the caller (a Python sock)
sock
Overrides: httxbase.HttxBase.request

getresponse(self, sock)

source code 

Recover a HttxResponse using a net location from the cache of active HttxNetLocation net locations and calling its getresponse

Parameters:
  • sock (opaque (a Python sock)) - The opaque type returned by request
Returns: HttxResponse (compatible with httplib HTTPResponse)
response
Overrides: httxbase.HttxBase.getresponse