Package DebTorrent :: Module zurllib :: Class urlopen
[hide private]
[frames] | no frames]

Class urlopen

source code

Opens a URL for reading.

Instance Methods [hide private]
 
__init__(self, url, ungzip=True)
Initialize the instance and call the open method.
source code
call graph 
 
_open(self, url)
Open a connection and request the URL, saving the response.
source code
call graph 
string
read(self)
Read the response data from the previous request.
source code
call graph 
string
_read(self)
Read the response data and maybe decompress it.
source code
call graph 
 
close(self)
Closes the connection to the server.
source code
Instance Variables [hide private]
btHTTPcon or btHTTPScon connection
the connection to the server
dictionary error_return
the bencoded returned data if an error occurred
httplib.HTTPResponse response
the response from the server
int tries
the number of attempts to open it so far
boolean ungzip
whether to ungzip any gzipped data that is received
Method Details [hide private]

__init__(self, url, ungzip=True)
(Constructor)

source code 
call graph 
Initialize the instance and call the open method.
Parameters:
  • url (string) - the URL to open
  • ungzip (boolean) - whether to ungzip any gzipped data that is received (optional, defaults to True)

_open(self, url)

source code 
call graph 
Open a connection and request the URL, saving the response.
Parameters:
  • url (string) - the URL to open
Raises:
  • IOError - if there was a problem with the URL, or if the server returned an error

read(self)

source code 
call graph 
Read the response data from the previous request.
Returns: string
the response, or the error if an error occurred

_read(self)

source code 
call graph 
Read the response data and maybe decompress it.
Returns: string
the processed response data