def __init__(self, endpoint, headers, retry_policy):
        self._endpoint = endpoint
        self._headers = headers
        self._retry_policy = retry_policy
        if self._endpoint.auth == constants.AUTH_KERBEROS:
            self._auth = HTTPKerberosAuth(**conf.kerberos_auth_configuration())
        elif self._endpoint.auth == constants.AUTH_BASIC:
            self._auth = (self._endpoint.username, self._endpoint.password)
        elif self._endpoint.auth == constants.GOOGLE_AUTH:
            credentials = (conf.google_auth_credentials())
            self._auth = credentials
            #Once we have credentials, we attach them to a transport. We use the transport to
            #make authenticated requests: how does self._session work? Do I not have to use
            #AuthorizedSession? Kerberos HTTPKerberosAuth attaches Kerberos Auth to Requests object
            #so should self._auth = credentials or authed_session?
            authed_session = AuthorizedSession(credentials)
        elif self._endpoint.auth != constants.NO_AUTH:
            raise BadUserConfigurationException(u"Unsupported auth %s" %
                                                self._endpoint.auth)
        self._session = requests.Session()

        self.logger = SparkLog(u"ReliableHttpClient")

        self.verify_ssl = not conf.ignore_ssl_errors()
        if not self.verify_ssl:
            self.logger.debug(
                u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks."
            )
            requests.packages.urllib3.disable_warnings()
Exemple #2
0
    def __init__(self, endpoint, headers, retry_policy):
        self._endpoint = endpoint
        self._headers = headers
        self._retry_policy = retry_policy

        if self._endpoint.auth == constants.AUTH_KERBEROS:
            if self._endpoint.krb_mutual_auth == constants.AUTH_KERBEROS_MUTUAL_REQ:
                mutual_auth = REQUIRED
            elif self._endpoint.krb_mutual_auth == constants.AUTH_KERBEROS_MUTUAL_OPT:
                mutual_auth = OPTIONAL
            elif self._endpoint.krb_mutual_auth == constants.AUTH_KERBEROS_MUTUAL_DIS:
                mutual_auth = DISABLED
            else:
                mutual_auth = REQUIRED
            if self._endpoint.krb_host_override == "":
                hostname_override = None
            else:
                hostname_override = self._endpoint.krb_host_override
            self._auth = HTTPKerberosAuth(mutual_authentication=mutual_auth,
                                          hostname_override=hostname_override)
        elif self._endpoint.auth == constants.AUTH_BASIC:
            self._auth = (self._endpoint.username, self._endpoint.password)
        elif self._endpoint.auth != constants.NO_AUTH:
            raise BadUserConfigurationException(u"Unsupported auth %s" %
                                                self._endpoint.auth)

        self.logger = SparkLog(u"ReliableHttpClient")

        self.verify_ssl = not conf.ignore_ssl_errors()
        if not self.verify_ssl:
            self.logger.debug(
                u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks."
            )
            requests.packages.urllib3.disable_warnings()
    def __init__(self, endpoint, headers, retry_policy):
        self._endpoint = endpoint
        self._headers = headers
        self._retry_policy = retry_policy
        self.logger = SparkLog(u"ReliableHttpClient")

        self.verify_ssl = not conf.ignore_ssl_errors()
        if not self.verify_ssl:
            self.logger.debug(u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks.")
            requests.packages.urllib3.disable_warnings()
 def __init__(self, endpoint, headers, retry_policy):
     self._endpoint = endpoint
     self._headers = headers
     self._retry_policy = retry_policy
     self._auth = self._endpoint.auth
     self._session = requests.Session()
     self.logger = SparkLog(u"ReliableHttpClient")
     self.verify_ssl = not conf.ignore_ssl_errors()
     if not self.verify_ssl:
         self.logger.debug(u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks.")
         requests.packages.urllib3.disable_warnings()
    def __init__(self, endpoint, headers, retry_policy):
        self._endpoint = endpoint
        self._headers = headers
        self._retry_policy = retry_policy
        if self._endpoint.auth_type == constants.AUTH_KERBEROS:
            self._auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
        elif self._endpoint.auth_type == constants.AUTH_BASIC:
            self._auth = (self._endpoint.username, self._endpoint.password)
        self.logger = SparkLog(u"ReliableHttpClient")

        self.verify_ssl = not conf.ignore_ssl_errors()
        if not self.verify_ssl:
            self.logger.debug(
                u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks."
            )
            requests.packages.urllib3.disable_warnings()
    def __init__(self, endpoint, headers, retry_policy):
        self._endpoint = endpoint
        self._headers = headers
        self._retry_policy = retry_policy
        if self._endpoint.auth == constants.AUTH_KERBEROS:
            self._auth = HTTPKerberosAuth(**conf.kerberos_auth_configuration())
        elif self._endpoint.auth == constants.AUTH_BASIC:
            self._auth = (self._endpoint.username, self._endpoint.password)
        elif self._endpoint.auth != constants.NO_AUTH:
            raise BadUserConfigurationException(u"Unsupported auth %s" %
                                                self._endpoint.auth)
        self._session = requests.Session()

        self.logger = SparkLog(u"ReliableHttpClient")

        self.verify_ssl = not conf.ignore_ssl_errors()
        if not self.verify_ssl:
            self.logger.debug(
                u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks."
            )
            requests.packages.urllib3.disable_warnings()