Package httxlib :: Module httxnetlocation :: Class HttxNetLocation
[hide private]
[frames] | no frames]

Class HttxNetLocation

source code

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

Net Location Connecting object. The HttxNetLocation is responsible for creating and managing a set of HttxConnection connection objects that will perform the actual connection

HttxConnection connections will be created on demand and re-used if possible. Active connections will be kept in a cache, whilst non-active will be kept in a double queue (next in use to be popped from the right, and after usage they wll be appended to the left

Due to the threading nature, a in-operation cache may hold connections during manipulation

Instance Methods [hide private]
 
__init__(self, url, **kwargs)
Constructor.
source code
HttxNetLocation @see clone
__deepcopy__(self, memo)
Deepcopy support.
source code
HttxNetLocation
clone(self, options=None, connections=True)
Clone the object using the supplied options or a new set of options if given.
source code
opaque type for the caller (a Python sock)
request(self, httxreq)
Send the HttxRequest httxreq to the specified server inside the request It does get a connection or create one and relay the request down to it, taking into account the HTTP keepalive timeout
source code
HttxResponse (compatible with httplib HTTPResponse)
getresponse(self, sock)
Recover a HttxResponse using the connection that is in the cache indexed by sock and calling its getresponse
source code

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

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

Instance Variables [hide private]
  httxconnache
Cache of connections with a pending request/response
  httxconnque
The double queue holding non-active connections
  inopcache
Temporary in-operation cache for connections during request/response
str url
url used to set the net location to which connections will connect

Inherited from httxbase.HttxBase: options

Inherited from httxobject.HttxObject: lock

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, url, **kwargs)
(Constructor)

source code 

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

Parameters:
  • url (str) - url to open a connection to
  • kwargs - keywords arguments passed to HttxBase
Overrides: object.__init__

See Also: HttxOptions

__deepcopy__(self, memo)

source code 

Deepcopy support.

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

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

source code 

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

An equivalente set of HttxConnection objects 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
  • connections (bool) - whether to clone the existing connections
Returns: HttxNetLocation
a cloned object

request(self, httxreq)

source code 

Send the HttxRequest httxreq to the specified server inside the request It does get a connection or create one and relay the request down to it, taking into account the HTTP keepalive timeout

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 the connection that is in the cache indexed by sock 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