(
            self, username, password, verify, client_id, client_secret,
            auth_mode)
return session
Create authenticated HTTP session for server communication.

        Args:
            username: User to authenticate as.
            password: User password.
            verify: Verify server SSL certificate.
            client_id: The client ID if OAUTH auth is used.
            client_secret: The OAUTH client secret if OAUTH is used.
            auth_mode: The authentication mode to use. Supported values are
                'userpass' (username/password combo), 'http-basic'
                (HTTP Basic authentication) and oauth.

        Returns:
            Instance of requests.Session.
Create authenticated HTTP session for server communication.
Create authenticated HTTP session for server communication .
def _create_session(
            self, username, password, verify, client_id, client_secret,
            auth_mode):
        """Create authenticated HTTP session for server communication.

        Args:
            username: User to authenticate as.
            password: User password.
            verify: Verify server SSL certificate.
            client_id: The client ID if OAUTH auth is used.
            client_secret: The OAUTH client secret if OAUTH is used.
            auth_mode: The authentication mode to use. Supported values are
                'userpass' (username/password combo), 'http-basic'
                (HTTP Basic authentication) and oauth.

        Returns:
            Instance of requests.Session.
        """
        if auth_mode == 'oauth':
            return self._create_oauth_session(client_id, client_secret)

        if auth_mode == 'oauth_local':
            return self._create_oauth_session(
                client_id=client_id, client_secret=client_secret,
                run_server=False, skip_open=True)

        session = requests.Session()

        # If using HTTP Basic auth, add the user/pass to the session
        if auth_mode == 'http-basic':
            session.auth = (username, password)

        # SSL Cert verification is turned on by default.
        if not verify:
            session.verify = False

        # Get and set CSRF token and authenticate the session if appropriate.
        self._set_csrf_token(session)
        if auth_mode == 'userpass':
            self._authenticate_session(session, username, password)

        return session
def _create_session ( self , username , password , verify , client_id , client_secret , auth_mode ) : if auth_mode == 'oauth' : return self . _create_oauth_session ( client_id , client_secret ) if auth_mode == 'oauth_local' : return self . _create_oauth_session ( client_id = client_id , client_secret = client_secret , run_server = False , skip_open = True ) session = requests . Session ( ) # If using HTTP Basic auth, add the user/pass to the session if auth_mode == 'http-basic' : session . auth = ( username , password ) # SSL Cert verification is turned on by default. if not verify : session . verify = False # Get and set CSRF token and authenticate the session if appropriate. self . _set_csrf_token ( session ) if auth_mode == 'userpass' : self . _authenticate_session ( session , username , password ) return session