Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,18 +710,24 @@

# Interactive prompts for missing config
if not args.dry_run and sys.stdin.isatty():
if not profile_ids:
print(f"{Colors.CYAN}ℹ Profile ID is missing.{Colors.ENDC}")
p_input = input(f"{Colors.BOLD}Enter Control D Profile ID:{Colors.ENDC} ").strip()
if p_input:
profile_ids = [p.strip() for p in p_input.split(",") if p.strip()]

if not TOKEN:
print(f"{Colors.CYAN}ℹ API Token is missing.{Colors.ENDC}")
import getpass
t_input = getpass.getpass(f"{Colors.BOLD}Enter Control D API Token:{Colors.ENDC} ").strip()
if t_input:
TOKEN = t_input
try:
if not profile_ids:
print(f"{Colors.CYAN}ℹ Profile ID is missing.{Colors.ENDC}")

Check notice

Code scanning / Bandit (reported by Codacy)

The input method in Python 2 will read from standard input, evaluate and run the resulting string as python source code. This is similar, though in many ways worse, then using eval. On Python 2, use raw_input instead, input is safe in Python 3. Note

The input method in Python 2 will read from standard input, evaluate and run the resulting string as python source code. This is similar, though in many ways worse, then using eval. On Python 2, use raw_input instead, input is safe in Python 3.
print(f"{Colors.CYAN} (Found in your Profile URL: https://controld.com/dashboard/profiles/<ID>){Colors.ENDC}")

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (127/100) Warning

Line too long (127/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (127/100) Warning

Line too long (127/100)
p_input = input(f"{Colors.BOLD}Enter Control D Profile ID:{Colors.ENDC} ").strip()
if p_input:
profile_ids = [p.strip() for p in p_input.split(",") if p.strip()]

if not TOKEN:

Check warning

Code scanning / Prospector (reported by Codacy)

Import outside toplevel (getpass) (import-outside-toplevel) Warning

Import outside toplevel (getpass) (import-outside-toplevel)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Import outside toplevel (getpass) Warning

Import outside toplevel (getpass)
print(f"{Colors.CYAN}ℹ API Token is missing.{Colors.ENDC}")

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (103/100) Warning

Line too long (103/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (103/100) Warning

Line too long (103/100)
print(f"{Colors.CYAN} (Generate in Preferences > API){Colors.ENDC}")
import getpass
t_input = getpass.getpass(f"{Colors.BOLD}Enter Control D API Token:{Colors.ENDC} ").strip()
if t_input:
TOKEN = t_input
except KeyboardInterrupt:
print(f"\n{Colors.WARNING}⚠️ Input cancelled.{Colors.ENDC}")
sys.exit(1)

if not profile_ids and not args.dry_run:
log.error("PROFILE missing and --dry-run not set. Provide --profiles or set PROFILE env.")
Expand Down
Loading