Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Private Attributes
urllib.error.HTTPError Class Reference
Inheritance diagram for urllib.error.HTTPError:
Inheritance graph
[legend]
Collaboration diagram for urllib.error.HTTPError:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __str__
def info
def getcode
def geturl
def __iter__
def __repr__
def close
def __enter__
def __exit__

Public Attributes

 code
 msg
 hdrs
 fp
 filename
 args
 reason
 headers
 url
 read
 readline
 readlines
 fileno
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Private Attributes

 __super_init = urllib.response.addinfourl.__init__

Detailed Description

Raised when HTTP error occurs, but also acts like non-error return

Definition at line 35 of file error.py.


Constructor & Destructor Documentation

def urllib.error.HTTPError.__init__ (   self,
  url,
  code,
  msg,
  hdrs,
  fp 
)

Definition at line 39 of file error.py.

00039 
00040     def __init__(self, url, code, msg, hdrs, fp):
00041         self.code = code
00042         self.msg = msg
00043         self.hdrs = hdrs
00044         self.fp = fp
00045         self.filename = url
00046         # The addinfourl classes depend on fp being a valid file
00047         # object.  In some cases, the HTTPError may not have a valid
00048         # file object.  If this happens, the simplest workaround is to
00049         # not initialize the base classes.
00050         if fp is not None:
00051             self.__super_init(fp, hdrs, url, code)

Here is the caller graph for this function:


Member Function Documentation

def urllib.response.addbase.__enter__ (   self) [inherited]

Definition at line 47 of file response.py.

00047 
00048     def __enter__(self):
00049         if self.fp is None:
00050             raise ValueError("I/O operation on closed file")
00051         return self

def urllib.response.addbase.__exit__ (   self,
  type,
  value,
  traceback 
) [inherited]

Definition at line 52 of file response.py.

00052 
00053     def __exit__(self, type, value, traceback):
00054         self.close()

def urllib.response.addbase.__iter__ (   self) [inherited]

Definition at line 27 of file response.py.

00027 
00028     def __iter__(self):
00029         # Assigning `__iter__` to the instance doesn't work as intended
00030         # because the iter builtin does something like `cls.__iter__(obj)`
00031         # and thus fails to find the _bound_ method `obj.__iter__`.
00032         # Returning just `self.fp` works for built-in file objects but
00033         # might not work for general file-like objects.
00034         return iter(self.fp)

def urllib.response.addbase.__repr__ (   self) [inherited]

Definition at line 35 of file response.py.

00035 
00036     def __repr__(self):
00037         return '<%s at %r whose fp = %r>' % (self.__class__.__name__,
00038                                              id(self), self.fp)

Reimplemented from urllib.error.URLError.

Definition at line 52 of file error.py.

00052 
00053     def __str__(self):
00054         return 'HTTP Error %s: %s' % (self.code, self.msg)
00055 
# exception raised when downloaded size does not match content-length
def urllib.response.addbase.close (   self) [inherited]

Reimplemented in urllib.response.addclosehook.

Definition at line 39 of file response.py.

00039 
00040     def close(self):
00041         self.read = None
00042         self.readline = None
00043         self.readlines = None
00044         self.fileno = None
00045         if self.fp: self.fp.close()
00046         self.fp = None

Here is the caller graph for this function:

def urllib.response.addinfourl.getcode (   self) [inherited]

Definition at line 92 of file response.py.

00092 
00093     def getcode(self):
00094         return self.code

def urllib.response.addinfourl.geturl (   self) [inherited]

Definition at line 95 of file response.py.

00095 
00096     def geturl(self):
00097         return self.url
def urllib.response.addinfourl.info (   self) [inherited]

Definition at line 89 of file response.py.

00089 
00090     def info(self):
00091         return self.headers

Here is the caller graph for this function:


Member Data Documentation

Definition at line 37 of file error.py.

Definition at line 27 of file error.py.

Reimplemented from urllib.response.addinfourl.

Definition at line 40 of file error.py.

Reimplemented from urllib.error.URLError.

Definition at line 44 of file error.py.

Definition at line 23 of file response.py.

Reimplemented from urllib.response.addbase.

Definition at line 43 of file error.py.

Definition at line 42 of file error.py.

Definition at line 85 of file response.py.

Definition at line 41 of file error.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 17 of file response.py.

Definition at line 18 of file response.py.

Definition at line 21 of file response.py.

Definition at line 28 of file error.py.

Definition at line 86 of file response.py.


The documentation for this class was generated from the following file: