Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.BasicAuthTransport.BasicAuthTransport Class Reference

List of all members.

Public Member Functions

def __init__
def request

Public Attributes

 username
 password
 verbose

Detailed Description

Definition at line 6 of file BasicAuthTransport.py.


Constructor & Destructor Documentation

def MoinMoin.support.BasicAuthTransport.BasicAuthTransport.__init__ (   self,
  username = None,
  password = None 
)

Definition at line 7 of file BasicAuthTransport.py.

00007 
00008     def __init__(self, username=None, password=None):
00009         self.username = username
00010         self.password = password
00011         self.verbose = 0


Member Function Documentation

def MoinMoin.support.BasicAuthTransport.BasicAuthTransport.request (   self,
  host,
  handler,
  request_body,
  kw 
)

Definition at line 12 of file BasicAuthTransport.py.

00012 
00013     def request(self, host, handler, request_body, **kw):
00014         # issue XML-RPC request
00015         h = httplib.HTTP(host)
00016         h.putrequest("POST", handler)
00017 
00018         # required by HTTP/1.1
00019         h.putheader("Host", host)
00020 
00021         # required by XML-RPC
00022         h.putheader("User-Agent", self.user_agent)
00023         h.putheader("Content-Type", "text/xml")
00024         h.putheader("Content-Length", str(len(request_body)))
00025 
00026         # basic auth
00027         if self.username is not None and self.password is not None:
00028             authhdr = "Basic %s" % encodestring("%s:%s" % (self.username, self.password)).replace("\012", "")
00029             h.putheader("Authorization", authhdr)
00030         h.endheaders()
00031 
00032         if request_body:
00033             h.send(request_body)
00034 
00035         errcode, errmsg, headers = h.getreply()
00036 
00037         if errcode != 200:
00038             raise xmlrpclib.ProtocolError(
00039                 host + handler,
00040                 errcode, errmsg,
00041                 headers
00042                 )
00043 
00044         return self.parse_response(h.getfile())
00045 

Here is the call graph for this function:


Member Data Documentation

Definition at line 9 of file BasicAuthTransport.py.

Definition at line 8 of file BasicAuthTransport.py.

Definition at line 10 of file BasicAuthTransport.py.


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