def session(self):
        """ Initialize the session """
        if self._session is None:
            self._session = requests.Session()
            log.debug("Connecting to {0}".format(self.auth_url))
            # Disable SSL warning when ssl_verify is False
            if not self.ssl_verify:
                requests.packages.urllib3.disable_warnings(
                    InsecureRequestWarning)
            if self.auth_type == 'basic':
                basic_auth = (self.auth_username, self.auth_password)
                response = self._session.get(
                    self.auth_url, auth=basic_auth, verify=self.ssl_verify)
            else:
                gssapi_auth = HTTPSPNEGOAuth(mutual_authentication=DISABLED)
                response = self._session.get(
                    self.auth_url, auth=gssapi_auth, verify=self.ssl_verify)
            try:
                response.raise_for_status()
            except requests.exceptions.HTTPError as error:
                log.error(error)
                raise ReportError('Jira authentication failed. Try kinit.')
        return self._session
def session ( self ) : if self . _session is None : self . _session = requests . Session ( ) log . debug ( "Connecting to {0}" . format ( self . auth_url ) ) if not self . ssl_verify : requests . packages . urllib3 . disable_warnings ( InsecureRequestWarning ) if self . auth_type == 'basic' : basic_auth = ( self . auth_username , self . auth_password ) response = self . _session . get ( self . auth_url , auth = basic_auth , verify = self . ssl_verify ) else : gssapi_auth = HTTPSPNEGOAuth ( mutual_authentication = DISABLED ) response = self . _session . get ( self . auth_url , auth = gssapi_auth , verify = self . ssl_verify ) try : response . raise_for_status ( ) except requests . exceptions . HTTPError as error : log . error ( error ) raise ReportError ( 'Jira authentication failed. Try kinit.' ) return self . _session
Initialize the session