httplib :: HTTPResponse :: Class HTTPResponse
[hide private]
[frames] | no frames]

Class HTTPResponse

Instance Methods [hide private]
 
__init__(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
 
_read_status(self)
 
begin(self)
Wrapper for HTTPResponse.begin to allow for the body to be read and leave the connection free for further re-use
source code
 
_check_close(self)
 
close(self)
 
isclosed(self)
str
read(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
 
_read_chunked(self, amt)
 
_safe_read(self, amt)
Read the number of bytes requested, compensating for partial reads.
 
fileno(self)
 
getheader(self, name, default=None)
 
getheaders(self)
Return list of (header, value) tuples.
 
_httxbegin(self)
 
_httxinit(self, sock, debuglevel=0, strict=0, method=None, buffering=False)
 
_httxread(self, amt=None)
bool
authenticating(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
str
getbody(self)
Utility function for a property get descriptor for body
source code
 
getbodyfile(self)
Utility function for a property tet descriptor for bodyfile
source code
list
getheaderlist(self, name)
return a list of all header returned with the same name (www-authenticate is an example)
source code
HTTPMessage
info(self)
Utility function to make HTTPResponse fully compatible with CookieJar requirements
source code
bool
isactive(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
isauth(self)
Utility function to check if a response is requesting authentication
source code
bool
isauthproxy(self)
Utility function to check if the requested authentication is proxy-authenticate
source code
bool
isauthuser(self)
Utility function to check if the requested authentication is www-authenticate
source code
bool
isredir(self)
Utility function to check if a response is requesting redirection
source code
bool
isredirget(self)
Utility function to check if the redir codes are good for a GET request
source code
bool
isredirpost(self)
Utility function to check if the redir codes are good for a POST request
source code
bool
isredirpostrfc2616(self)
Utility function to check if the redir codes are good for a POST request according to RFC 2616
source code
bool
redirecting(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
redirecting_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
 
setbody(self, value)
Utility function for a property set descriptor for body
source code
Properties [hide private]
str body
Utility function for a property get descriptor for body
  bodyfile
Utility function for a property tet descriptor for bodyfile
  headers
Return list of (header, value) tuples.
Method Details [hide private]

__init__(self, sock, debuglevel=0, strict=0, method=None)
(Constructor)

source code 

It replaces the HTTPResponse.__init__ to allow to add and initialize a member variable at object instantiation

Sock is the opaque type (actually a Python sock object) used in HttxLib to index connecting objects with pending network activity

read(self, amt=None)

source code 

Wrapper for HTTPResponse.read to read the body contents from the StringIO object created during httxbegin connection free for further re-use

Parameters:
  • amt (int or None) - amount of bytes to be read
Returns: str
the read bytes

_safe_read(self, amt)

 

Read the number of bytes requested, compensating for partial reads.

Normally, we have a blocking socket, but a read() can be interrupted by a signal (resulting in a partial read).

Note that we cannot distinguish between EOF and an interrupt when zero bytes have been read. IncompleteRead() will be raised in this situation.

This function should be used when <amt> bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem.

authenticating(self)

source code 

Utility function to check if a response indicates that pending network activity exists, because a new request has been isssued following an authentication request

Returns: bool
if a response is undergoing network activity because an authentication request has been sent

getbody(self)

source code 

Utility function for a property get descriptor for body

Returns: str
the body of the http response

getheaderlist(self, name)

source code 

return a list of all header returned with the same name (www-authenticate is an example)

Parameters:
  • name (str) - name of the header
Returns: list
a list of the values sent for the header

info(self)

source code 

Utility function to make HTTPResponse fully compatible with CookieJar requirements

Returns: HTTPMessage
the message object from HTTPResponse

isactive(self)

source code 

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

Returns: bool
if the response is underdoing a redirection or authentication and network activity is pending

isauth(self)

source code 

Utility function to check if a response is requesting authentication

Returns: bool
if a response is requesting authentication

isauthproxy(self)

source code 

Utility function to check if the requested authentication is proxy-authenticate

Returns: bool
if the requested authentication is proxy-authenticate

isauthuser(self)

source code 

Utility function to check if the requested authentication is www-authenticate

Returns: bool
if the requested authentication is www-authenticate

isredir(self)

source code 

Utility function to check if a response is requesting redirection

Returns: bool
if the response is a request to redirect

isredirget(self)

source code 

Utility function to check if the redir codes are good for a GET request

Returns: bool
if the redir codes are good for a GET request

isredirpost(self)

source code 

Utility function to check if the redir codes are good for a POST request

Returns: bool
if the redir codes are good for a POST request

isredirpostrfc2616(self)

source code 

Utility function to check if the redir codes are good for a POST request according to RFC 2616

Returns: bool
if the redir codes are good for a POST request according to RFC 2616

redirecting(self)

source code 

Utility function to check if a response indicates that pending network activity exists, because a new request has been isssued following a redirect request

Returns: bool
if a response is undergoing network activity because a redirection request has been sent

redirecting_or_authenticating(self)

source code 

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

Returns: bool
if the response is underdoing a redirection or authentication and network activity is pending

setbody(self, value)

source code 

Utility function for a property set descriptor for body

Parameters:
  • value (str) - the body of the http response to set

Property Details [hide private]

body

Utility function for a property get descriptor for body

Get Method:
unreachable.httxgetbody(self) - Utility function for a property get descriptor for body
Set Method:
unreachable.httxsetbody(self, value) - Utility function for a property set descriptor for body
Type:
str

bodyfile

Utility function for a property tet descriptor for bodyfile

Get Method:
unreachable.httxgetbodyfile(self) - Utility function for a property tet descriptor for bodyfile

headers

Return list of (header, value) tuples.

Get Method:
unreachable.getheaders(self) - Return list of (header, value) tuples.