(self, params, **kwargs)
| 2671 | return False |
| 2672 | |
| 2673 | def execute(self, params, **kwargs): |
| 2674 | if not params.user: |
| 2675 | print("Not logged in") |
| 2676 | return |
| 2677 | |
| 2678 | has_clone_code = bool(params.clone_code) |
| 2679 | has_session = bool(params.session_token) |
| 2680 | |
| 2681 | if not has_clone_code and not has_session: |
| 2682 | print("Not logged in") |
| 2683 | return |
| 2684 | |
| 2685 | if has_session: |
| 2686 | print("Logged in") |
| 2687 | return |
| 2688 | |
| 2689 | if has_clone_code: |
| 2690 | try: |
| 2691 | class NonInteractiveLoginUi: |
| 2692 | def on_device_approval(self, step): |
| 2693 | step.cancel() |
| 2694 | |
| 2695 | def on_two_factor(self, step): |
| 2696 | step.cancel() |
| 2697 | |
| 2698 | def on_password(self, step): |
| 2699 | step.cancel() |
| 2700 | |
| 2701 | def on_sso_redirect(self, step): |
| 2702 | step.cancel() |
| 2703 | |
| 2704 | def on_sso_data_key(self, step): |
| 2705 | step.cancel() |
| 2706 | |
| 2707 | api.login(params, new_login=False, login_ui=NonInteractiveLoginUi()) |
| 2708 | |
| 2709 | if params.session_token: |
| 2710 | print("Logged in") |
| 2711 | else: |
| 2712 | print("Not logged in") |
| 2713 | |
| 2714 | except Exception as e: |
| 2715 | logging.debug(f"Non-interactive login failed: {e}") |
| 2716 | print("Not logged in") |
| 2717 | else: |
| 2718 | print("Not logged in") |
nothing calls this directly
no test coverage detected