0

there is the code :

import phonenumbers
from phonenumbers import geocoder
number = input("enter the number : ")
ch_number = phonenumbers.parse(number, "CH")
print(geocoder.description_for_number(ch_number, "english"))

from phonenumbers import carrier 
service_number= phonenumbers.parse(number , "RO")
print(carrier.name_for_number(service_number , "english"))

I can't realise what the problem is !

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0

As Barmar suggested, switching "english" to "en" fixes the issue.

import phonenumbers
from phonenumbers import geocoder, carrier    

number = "+919876543210"  # example input
ch_number = phonenumbers.parse(number, 'CH')
print("Region: " + geocoder.description_for_number(ch_number, "en"))

service_number= phonenumbers.parse(number , 'RO')
print("Carrier: " + carrier.name_for_number(service_number , "en"))

Prints:

Region: India
Carrier: Airtel
Rory
  • 159
  • 1
  • 8
  • It's worked . And I realized that the problem is in the VPN , when I use the VPN , the program doesn't return the country (my country) , but it return the country of another number (another country) . – Amine Errachdi Dec 10 '22 at 13:56