diff --git a/graphistry/pygraphistry.py b/graphistry/pygraphistry.py index 4ab0460a91..d4f3330791 100644 --- a/graphistry/pygraphistry.py +++ b/graphistry/pygraphistry.py @@ -211,6 +211,8 @@ def sso_login(org_name=None, idp_name=None, sso_timeout=SSO_GET_TOKEN_ELAPSE_SEC :type idp_name: Optional[str] :param sso_timeout: Set sso login getting token timeout in seconds (blocking mode), set to None if non-blocking mode. Default as SSO_GET_TOKEN_ELAPSE_SECONDS. :type sso_timeout: Optional[int] + :param opt_into_type: Show the SSO url with display(), webbrowser.open(), or print() + :type opt_into_type: Optional[Literal["display", "browser"]] :returns: token or auth_url :rtype: Optional[str] @@ -257,6 +259,8 @@ def _handle_auth_url(auth_url, sso_timeout, opt_into_type): :type auth_url: str :param sso_timeout: Set sso login getting token timeout in seconds (blocking mode), set to None if non-blocking mode. Default as SSO_GET_TOKEN_ELAPSE_SECONDS. :type sso_timeout: Optional[int] + :param opt_into_type: Show the SSO url with display(), webbrowser.open(), or print() + :type opt_into_type: Optional[Literal["display", "browser"]] :returns: token :rtype: token: Optional[str] @@ -568,7 +572,7 @@ def register( idp_name: Optional[str] = None, is_sso_login: Optional[bool] = False, sso_timeout: Optional[int] = SSO_GET_TOKEN_ELAPSE_SECONDS, - sso_opt_into_type: Optional[str] = None + sso_opt_into_type: Optional[Literal["display", "browser"]] = None ): """API key registration and server selection @@ -612,6 +616,8 @@ def register( :type idp_name: Optional[str] :param sso_timeout: Set sso login getting token timeout in seconds (blocking mode), set to None if non-blocking mode. Default as SSO_GET_TOKEN_ELAPSE_SECONDS. :type sso_timeout: Optional[int] + :param sso_opt_into_type: Show the SSO url with display(), webbrowser.open(), or print() + :type sso_opt_into_type: Optional[Literal["display", "browser"]] :returns: None. :rtype: None @@ -627,6 +633,14 @@ def register( import graphistry graphistry.register(api=3, protocol='http', server='200.1.1.1', org_name="org-name") + **Example: Override SSO url display method to use `display()`, `webbrowser.open()`, or just `print()`** + :: + + import graphistry + graphistry.register(api=3, protocol='http', server='200.1.1.1', org_name="org-name", sso_opt_into_type="display") + graphistry.register(api=3, protocol='http', server='200.1.1.1', org_name="org-name", sso_opt_into_type="browser") + graphistry.register(api=3, protocol='http', server='200.1.1.1', org_name="org-name", sso_opt_into_type=None) + **Example: Standard (2.0 api by username/password with org_name)** :: @@ -696,7 +710,7 @@ def register( PyGraphistry.api_token(token or PyGraphistry._config['api_token']) elif not (org_name is None) or is_sso_login: print(MSG_REGISTER_ENTER_SSO_LOGIN) - PyGraphistry.sso_login(org_name, idp_name, sso_timeout=sso_timeout, sso_opt_into_type=None) + PyGraphistry.sso_login(org_name, idp_name, sso_timeout=sso_timeout, opt_into_type=sso_opt_into_type) @staticmethod def __check_login_type_to_reset_token_creds(