예제 #1
0
 def u2handlers(self):
     # try to import ntlm support
     try:
         from ntlm import HTTPNtlmAuthHandler
     except ImportError:
         raise Exception("Cannot import python-ntlm module")
     handlers = HttpTransport.u2handlers(self)
     handlers.append(HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(self.pm))
     return handlers
예제 #2
0
 def __init__(self, **kwargs):
     """
     @param kwargs: Keyword arguments.
         - B{proxy} - An http proxy to be specified on requests.
              The proxy is defined as {protocol:proxy,}
                 - type: I{dict}
                 - default: {}
         - B{timeout} - Set the url open timeout (seconds).
                 - type: I{float}
                 - default: 90
         - B{username} - The username used for http authentication.
                 - type: I{str}
                 - default: None
         - B{password} - The password used for http authentication.
                 - type: I{str}
                 - default: None
     """
     HttpTransport.__init__(self, **kwargs)
     self.pm = u2.HTTPPasswordMgrWithDefaultRealm()
예제 #3
0
 def u2handlers(self):
         handlers = HttpTransport.u2handlers(self)
         handlers.append(u2.HTTPBasicAuthHandler(self.pm))
         return handlers
예제 #4
0
 def send(self, request):
     self.addcredentials(request)
     return  HttpTransport.send(self, request)
예제 #5
0
 def open(self, request):
     self.addcredentials(request)
     return  HttpTransport.open(self, request)