Package httxlib :: Module httxbase :: Class HttxBase
[hide private]
[frames] | no frames]

Class HttxBase

source code

           object --+    
                    |    
httxobject.HttxObject --+
                        |
                       HttxBase
Known Subclasses:

Base of HttxLib classes that make a connection providing the definition and (in some cases) the implementation of primitives

Instance Methods [hide private]
 
__init__(self, **kwargs)
Contructor
source code
 
add_ca_cert(self, url, ca_cert)
Sets the path to a file that contains the root (chain) certificate(s) to be used if the certificate of the server pointed by url has been requested to be verified with add_cert_req and ssl.CERT_OPTIONAL or ssl.CERT_REQUIRED was specified Please check the Python SSL documentation
source code
 
add_cert_req(self, url, cert_req)
Sets the certificate verification level for the server certificate in the given url.
source code
 
add_certkey(self, url, certfile, keyfile)
Sets a certificate file and (if needed) a private key file to be used for https authentication in the domain given in the url The private key file is needed if the private key is not stored in the certificate.
source code
 
add_password(self, realm, url, username, password)
Sets a username and password for a realm and base url
source code
HttxResponse (compatible with httplib HTTPResponse) @raise NotImplemented
getresponse(self, sock)
Recover a HttxResponse corresponding to the sock (returned by request This is the abstract definition.
source code
opaque type for the caller (a Python sock) @raise NotImplemented
request(self, httxreq)
Send the HttxRequest httxreq to the specified server inside the request This is the abstract definition.
source code
 
setdecompmethods(self, decompmethods)
Helper method to set the decompression methods
source code
 
setoptions(self, **kwargs)
Sets the options at any time during execution
source code
 
setproxy(self, proxy)
Set the proxy for the HttxLib connecting object.
source code
 
setuseragent(self, useragent)
Helper method to set the User-Agent header
source code
HttxResponse (compatible with httplib HTTPResponse)
urlopen(self, httxreq)
Fecth a url specified in the HttxRequest httxreq object and return it in the form of an HttxResponse
source code

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 

Contructor

Parameters:
Overrides: object.__init__

See Also: HttxOptions

add_ca_cert(self, url, ca_cert)

source code 

Sets the path to a file that contains the root (chain) certificate(s) to be used if the certificate of the server pointed by url has been requested to be verified with add_cert_req and ssl.CERT_OPTIONAL or ssl.CERT_REQUIRED was specified Please check the Python SSL documentation

Parameters:
  • url (str) - url (domain) for which to apply. It can be empty to match all
  • ca_cert (str) - path to a file containing the root (chain) certificate(s)

See Also: add_cert_req

add_cert_req(self, url, cert_req)

source code 

Sets the certificate verification level for the server certificate in the given url. A (chain of) root certificate(s) has to be supplied with add_ca_cert Please check the Python SSL documentation

Parameters:
  • url (str) - url (domain) for which to apply. It can be empty to match all
  • cert_req (enumeration ssl.CERT_NONE, ssl.CERT_OPTIONAL, ssl.CERT_REQUIRED) - verification level

See Also: add_ca_cert

add_certkey(self, url, certfile, keyfile)

source code 

Sets a certificate file and (if needed) a private key file to be used for https authentication in the domain given in the url The private key file is needed if the private key is not stored in the certificate. Please check the Python SSL documentation to learn more

Parameters:
  • url (str) - url (domain) for which to apply. It can be empty to match all
  • certfile (str) - path to the cerfiticate file to be used
  • keyfile (str) - path to the private key file (if not stored in the cerfiticate) corresponding to the certificate

add_password(self, realm, url, username, password)

source code 

Sets a username and password for a realm and base url

Parameters:
  • realm (str) - Realm of application. It can be None
  • url (str) - base url for which to apply. It can be empty to match all
  • username (str) - username for realm and base url
  • password (str) - username for realm and base url

getresponse(self, sock)

source code 

Recover a HttxResponse corresponding to the sock (returned by request This is the abstract definition. To be implemented by connecting objects

Parameters:
  • sock (opaque (a Python sock)) - The opaque type returned by request
Returns: HttxResponse (compatible with httplib HTTPResponse) @raise NotImplemented
response

request(self, httxreq)

source code 

Send the HttxRequest httxreq to the specified server inside the request This is the abstract definition. To be implemented by connecting objects

Parameters:
  • httxreq (HttxRequest or url (string)) - Request or url to be executed
Returns: opaque type for the caller (a Python sock) @raise NotImplemented
sock

setdecompmethods(self, decompmethods)

source code 

Helper method to set the decompression methods

Parameters:
  • decompmethods (list) - desired decompression methods

setoptions(self, **kwargs)

source code 

Sets the options at any time during execution

Parameters:
  • kwargs - keyword arguments for options

See Also: HttxOptions

setproxy(self, proxy)

source code 

Set the proxy for the HttxLib connecting object. This is the abstract definition. To be implemented by connecting objects The proxy can be different for http and https connections.

Parameters:
  • proxy (dict @raise NotImplemented) - proxy servers. Dictionary with scheme:url pairs. '*' as scheme stands for both http and https

setuseragent(self, useragent)

source code 

Helper method to set the User-Agent header

Parameters:
  • useragent (str) - the user agent to fake

urlopen(self, httxreq)

source code 

Fecth a url specified in the HttxRequest httxreq object and return it in the form of an HttxResponse

Parameters:
  • httxreq (HttxRequest or url (string)) - Request or url to be fetched
Returns: HttxResponse (compatible with httplib HTTPResponse)
response