Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
urllib.request.HTTPPasswordMgrWithDefaultRealm Class Reference
Inheritance diagram for urllib.request.HTTPPasswordMgrWithDefaultRealm:
Inheritance graph
[legend]
Collaboration diagram for urllib.request.HTTPPasswordMgrWithDefaultRealm:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def find_user_password
def add_password
def reduce_uri
def is_suburi

Public Attributes

 passwd

Detailed Description

Definition at line 780 of file request.py.


Member Function Documentation

def urllib.request.HTTPPasswordMgr.add_password (   self,
  realm,
  uri,
  user,
  passwd 
) [inherited]

Definition at line 721 of file request.py.

00721 
00722     def add_password(self, realm, uri, user, passwd):
00723         # uri could be a single URI or a sequence
00724         if isinstance(uri, str):
00725             uri = [uri]
00726         if not realm in self.passwd:
00727             self.passwd[realm] = {}
00728         for default_port in True, False:
00729             reduced_uri = tuple(
00730                 [self.reduce_uri(u, default_port) for u in uri])
00731             self.passwd[realm][reduced_uri] = (user, passwd)

Here is the call graph for this function:

Reimplemented from urllib.request.HTTPPasswordMgr.

Definition at line 782 of file request.py.

00782 
00783     def find_user_password(self, realm, authuri):
00784         user, password = HTTPPasswordMgr.find_user_password(self, realm,
00785                                                             authuri)
00786         if user is not None:
00787             return user, password
00788         return HTTPPasswordMgr.find_user_password(self, None, authuri)
00789 

def urllib.request.HTTPPasswordMgr.is_suburi (   self,
  base,
  test 
) [inherited]
Check if test is below base in a URI tree

Both args must be URIs in reduced form.

Definition at line 765 of file request.py.

00765 
00766     def is_suburi(self, base, test):
00767         """Check if test is below base in a URI tree
00768 
00769         Both args must be URIs in reduced form.
00770         """
00771         if base == test:
00772             return True
00773         if base[0] != test[0]:
00774             return False
00775         common = posixpath.commonprefix((base[1], test[1]))
00776         if len(common) == len(base[1]):
00777             return True
00778         return False
00779 

Here is the caller graph for this function:

def urllib.request.HTTPPasswordMgr.reduce_uri (   self,
  uri,
  default_port = True 
) [inherited]
Accept authority or URI and extract only the authority and path.

Definition at line 742 of file request.py.

00742 
00743     def reduce_uri(self, uri, default_port=True):
00744         """Accept authority or URI and extract only the authority and path."""
00745         # note HTTP URLs do not have a userinfo component
00746         parts = urlsplit(uri)
00747         if parts[1]:
00748             # URI
00749             scheme = parts[0]
00750             authority = parts[1]
00751             path = parts[2] or '/'
00752         else:
00753             # host or host:port
00754             scheme = None
00755             authority = uri
00756             path = '/'
00757         host, port = splitport(authority)
00758         if default_port and port is None and scheme is not None:
00759             dport = {"http": 80,
00760                      "https": 443,
00761                      }.get(scheme)
00762             if dport is not None:
00763                 authority = "%s:%d" % (host, dport)
00764         return authority, path

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 719 of file request.py.


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