From 3c9cb2ab99335b79a94003af956cbfab2fed2a6a Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:35:48 +0000 Subject: [PATCH] click.prompt to input for notebooks compatibility --- pyproject.toml | 2 +- telegram_phone_number_checker/main.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index edcbde2..983a7e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "telegram-phone-number-checker" -version = "1.0.1" +version = "1.0.2" description = "Check if phone numbers are connected to Telegram accounts." authors = ["Bellingcat"] license = "MIT" diff --git a/telegram_phone_number_checker/main.py b/telegram_phone_number_checker/main.py index 6b0bcc3..f2828dc 100644 --- a/telegram_phone_number_checker/main.py +++ b/telegram_phone_number_checker/main.py @@ -46,7 +46,7 @@ def validate_users(client, phone_numbers): The function uses the get_api_response function to first check if the user exists and if it does, then it returns the first user name and the last user name. ''' if not phone_numbers or not len(phone_numbers): - phone_numbers = click.prompt('Enter the phone numbers to check, separated by commas') + phone_numbers = input('Enter the phone numbers to check, separated by commas: ') result = {} phones = [p.strip() for p in phone_numbers.split(",")] try: @@ -62,9 +62,9 @@ def validate_users(client, phone_numbers): def login(api_id, api_hash, phone_number): """Create a telethon session or reuse existing one""" print('Logging in...', end="", flush=True) - API_ID = api_id or os.getenv('API_ID') or click.prompt('Enter your API ID') - API_HASH = api_hash or os.getenv('API_HASH') or click.prompt('Enter your API HASH') - PHONE_NUMBER = phone_number or os.getenv('PHONE_NUMBER') or click.prompt('Enter your phone number') + API_ID = api_id or os.getenv('API_ID') or input('Enter your API ID: ') + API_HASH = api_hash or os.getenv('API_HASH') or input('Enter your API HASH: ') + PHONE_NUMBER = phone_number or os.getenv('PHONE_NUMBER') or input('Enter your phone number: ') client = TelegramClient(PHONE_NUMBER, API_ID, API_HASH) client.connect() if not client.is_user_authorized():