This module implements a series of hacks to the HTTPResponse class to
enable extra functionaliy (and practical in some cases) for the
HttxLib
Rather than creating a new class and given that HTTPResponse is
already well suited for usage in CookieJars (except for the missing info
method), extending the class seems suitable.
Subclassing is not possible, because the HTTPResponse is instantiated
inside httplib.
Creating a class and instantiating it out of the data stored in the
HTTPResponse would be possible but data would have to be copied for each
response.
This alternative seems the better: patching the class definition at
the start of the program and therefore be able to use the instantiated
HTTPResponse everywhere
|
httxinit(self,
sock,
debuglevel=0,
strict=0,
method=None)
It replaces the HTTPResponse.__init__ to allow to add and initialize
a member variable at object instantiation |
source code
|
|
bool
|
httxredirecting_or_authenticating(self)
Utility function to check if a response is underdoing a redirection
or authentication and network activity is pending redirection or a
CONNECT tunnel has been initiated |
source code
|
|
bool
|
|
bool
|
|
bool
|
|
bool
|
|
bool
|
|
bool
|
httxredirecting(self)
Utility function to check if a response indicates that pending
network activity exists, because a new request has been isssued
following a redirect request |
source code
|
|
bool
|
httxauthenticating(self)
Utility function to check if a response indicates that pending
network activity exists, because a new request has been isssued
following an authentication request |
source code
|
|
bool
|
|
bool
|
|
HTTPMessage
|
httxinfo(self)
Utility function to make HTTPResponse fully compatible with CookieJar
requirements |
source code
|
|
|
httxbegin(self)
Wrapper for HTTPResponse.begin to allow for the body to be read and
leave the connection free for further re-use |
source code
|
|
str
|
httxread(self,
amt=None)
Wrapper for HTTPResponse.read to read the body contents from the
StringIO object created during httxbegin connection free for further
re-use |
source code
|
|
str
|
|
|
|
|
httxgetbodyfile(self)
Utility function for a property tet descriptor for bodyfile |
source code
|
|
list
|
|