Exemple #1
0
 def addAuthentication(self, httpClient, method):
     BasicAuthStrategy.addAuthentication(self, httpClient, method)
     url = URL(self.__baseUrl)
     proxy = ProxySelector.getDefault().select(url.toURI()).get(0)
     httpClient.getParams().setAuthenticationPreemptive(False);
     if not proxy.type().equals(Proxy.Type.DIRECT):
         address = proxy.address()
         proxyHost = address.getHostName()
         proxyPort = address.getPort()
         httpClient.getHostConfiguration().setProxy(proxyHost, proxyPort)
         print "Using proxy '%s:%s'" % (proxyHost, proxyPort)
Exemple #2
0
 def __init__(self, username, password, baseUrl):
     BasicAuthStrategy.__init__(self, username, password)
     self.__baseUrl = baseUrl