def testGetTimeZonesForValidNumber(self): # Test with invalid numbers even when their country code prefixes exist in the mapper. self.assertEqual(_NANPA_TZ_LIST, time_zones_for_geographical_number(US_INVALID_NUMBER)) self.assertEqual((_SEOUL_TZ, ), time_zones_for_geographical_number(KO_INVALID_NUMBER)) # Test with valid prefixes. self.assertEqual((_SYDNEY_TZ, ), time_zones_for_geographical_number(AU_NUMBER)) self.assertEqual((_SEOUL_TZ, ), time_zones_for_geographical_number(KO_NUMBER)) self.assertEqual((_WINNIPEG_TZ, ), time_zones_for_geographical_number(CA_NUMBER)) self.assertEqual((_LOS_ANGELES_TZ, ), time_zones_for_geographical_number(US_NUMBER1)) self.assertEqual((_NEW_YORK_TZ, ), time_zones_for_geographical_number(US_NUMBER2)) # Test with an invalid country code. self.assertEqual( _UNKNOWN_TIME_ZONE_LIST, time_zones_for_geographical_number( NUMBER_WITH_INVALID_COUNTRY_CODE)) # Test with a non geographical phone number. self.assertEqual( _UNKNOWN_TIME_ZONE_LIST, time_zones_for_geographical_number(INTERNATIONAL_TOLL_FREE))
def testGetTimeZonesForValidNumber(self): # Test with invalid numbers even when their country code prefixes exist in the mapper. self.assertEqual(_NANPA_TZ_LIST, time_zones_for_geographical_number(US_INVALID_NUMBER)) self.assertEqual((_SEOUL_TZ,), time_zones_for_geographical_number(KO_INVALID_NUMBER)) # Test with valid prefixes. self.assertEqual((_SYDNEY_TZ,), time_zones_for_geographical_number(AU_NUMBER)) self.assertEqual((_SEOUL_TZ,), time_zones_for_geographical_number(KO_NUMBER)) self.assertEqual((_WINNIPEG_TZ,), time_zones_for_geographical_number(CA_NUMBER)) self.assertEqual((_LOS_ANGELES_TZ,), time_zones_for_geographical_number(US_NUMBER1)) self.assertEqual((_NEW_YORK_TZ,), time_zones_for_geographical_number(US_NUMBER2)) # Test with an invalid country code. self.assertEqual(_UNKNOWN_TIME_ZONE_LIST, time_zones_for_geographical_number(NUMBER_WITH_INVALID_COUNTRY_CODE)) # Test with a non geographical phone number. self.assertEqual(_UNKNOWN_TIME_ZONE_LIST, time_zones_for_geographical_number(INTERNATIONAL_TOLL_FREE))
def main(): window, settings = None, load_settings(SETTINGS_FILE, DEFAULT_SETTINGS) while True: if window is None: window = create_main_window(settings) event, values = window.Read(timeout=10) time = tim() window.Element('_DATE_').Update(str(time)) if event in (None, 'Exit'): break elif event == 'Show': info = values['-key-'].rstrip() number = numb(info) print(info) print(geocoder.description_for_number(number, 'en')) print(carrier.name_for_number(number, 'en')) print(timezone.time_zones_for_geographical_number(number)) elif event == 'Settings': event, values = create_settings_window(settings).read(close=True) if event == 'Save': window.close() window = None save_settings(SETTINGS_FILE, settings, values) elif event == 'Copy': info = values['-key-'].rstrip() pyperclip.copy(str(info)) pyperclip.paste() elif event == 'Paste': text = pyperclip.paste() window.Element('-key-').Update(str(text)) elif event == 'paypal': webbrowser.open_new_tab( "https://www.paypal.com/donate/?cmd=_s-xclick&hosted_button_id=PFB6A6HLAQHC2&source=url" ) elif event == 'bitcoin': webbrowser.open_new_tab( "https://commerce.coinbase.com/checkout/149a6235-ec7e-4d3b-a1ae-b08c4f08b4f6" ) elif event == 'About...': window.disappear() sg.popup('About:', 'Created by Adrijan P.', 'Phone number info', 'Version 1.1') window.reappear() window.Close()
def main(): st.title("Phone Number Location Tracker & Service operator") st.subheader("Built With Python") mobile = st.text_input("Enter Phone Number") if st.button("Track"): ch_number = phonenumbers.parse(mobile, 'CH') st.success("Country Name {}".format( geocoder.description_for_number(ch_number, "en"))) service_operator = phonenumbers.parse(mobile, 'RO') st.success("Service Operator: {}".format( carrier.name_for_number(service_operator, "en"))) time_place = phonenumbers.parse(mobile, "RO") st.success("The timezone: {}".format( timezone.time_zones_for_geographical_number(time_place))) area = phonenumbers.parse(mobile, "CH") st.success("Area length: {}".format( geocoder.country_name_for_number(area, "en"))) meta = phonenumbers.parse(mobile, "EN") st.success("Meta Info: {}".format( phonemetadata.PhoneMetadata(meta, "en")))
async def informNumberFree(phone, chat_id): phone = "+" + phone try: z = phonenumbers.parse(str(phone), None) vall = phonenumbers.is_valid_number(z) if vall == True: vall = 'Существует' else: vall = 'Не существует' coun = geocoder.description_for_number(z, 'ru') timee = timezone.time_zones_for_geographical_number(z) oper = carrier.name_for_number(z, "ru") await bot.send_message(chat_id, f""" 🌀 <b>Premium Version</b> 🌐<i><b>Номер: </b>{phone}</i> ├Страна: <i>{coun}</i> ├TimeZone: <i>{timee[0]}</i> ├Оператор: <i>{oper}</i> """, parse_mode="html", disable_web_page_preview=True) except Exception as e: await bot.send_message(chat_id, 'Инормация по этому номеру не найдена..')
import phonenumbers from phonenumbers import timezone from phonenumbers import carrier from phonenumbers import geocoder mob = phonenumbers.parse('+447986') car = carrier.name_for_number(mob, 'en') print(car) location = geocoder.country_name_for_number(mob, 'en') print(location) tz = timezone.time_zones_for_geographical_number(mob) print(tz) # is number already registered x = phonenumbers.is_valid_number(mob) print(x) # can be the number registered y = phonenumbers.is_possible_number(mob) print(y) text = 'hii my name is xyz and my phone number is +916387873015' for match in phonenumbers.phonenumbermatcher(text, 'US'): print(match)