hi everyone welcome back to our another python project and in this python project we will create
a python program so that we can track phone number and find the location in google map using python
for this python project we will be installing some python packages and then we will need a
phone number which one we want to track now in a few moments i will show you how to do that
but before we get started if you guys are new in my channel then please please subscribe
like this video and press the bell icon for the future videos that's it guys let's get started
first open your favorite code editor and then you have to create a new project file
here you can see that i have created one track location and inside this project folder you
have to create two separate python file so let's create our first one so click right
and from our new we have to select our python file and here you have to give the python file name
and it will be main dot py that's it so after this one now we have to create another python file
so that's why i can go to our project folder select write
you have to create a python file and then give a name here inside this file i will put a phone
number which we are going to track so that's why the python file name will be my phone dot pi
that's it so guys here you can see that we have created two different file one is main dot pi
and another one is my phone dot pi and here inside this my phone dot pi first i'm going to create a
variable and it will be number and here i'm going to insert my phone number which one i'm going to
locate and guys please pay attention the phone number i am using for this project is
my personal phone number so for some secret reason i am going to hide the phone number
that's it here you can see that i have my phone number here so after our this phone number now we
have to go to our main dot pi and here first we have to import a python package which is
phone numbers so now we have to install it so for installing let's go to our terminal
and here we have to write pip install phone numbers that's it and then type enter
in a few moments the package will be installed in your computer
guys here you can see that we have successfully installed our phone numbers
now after installing the phone numbers we have to import the phone numbers in our project file
that's why we have to write import phone numbers
now after importing our phone numbers we have to input the number variable which we have created
in our my phone dot pi so that's why we have to write from my phone import and we have a number
variable that's it first from our this phone number i'm going to extract the country name
okay so for extracting the country name we have to import another module from our phone numbers
and this one will be geocoder that's it so first we have to divide these four numbers
into some separate parts so for doing this here we have to create a variable
and here the variable will be pep number and here we have to call our phone numbers
and parse and here we have to give the name of the variable which variable is containing
our number so here you can see that our this number variable is actually containing our number
so that's why we have to write here number that's it and then we have to extract the
country location so that's why we have to create another variable and it will be location
and here we have to call our geocoder dot description for number that's it and here we have
to give two parameter one parameter will take our this divided variable and then another variable
will take a value for our language and it will be english that's it now here first i want to see the
country location so that's why we have to print the location that's it now if i run the program
and guys here you can see that it is showing my country name because the phone number i have given
is actually a bangladeshi number because i am from bangladesh and i have to use the bangladeshi
number so that's why it is showing my country name bangladesh so after our country name i want to see
the service provider name also so for seeing this one first from phone numbers we have to import
another module and it will be carrier that's it and here i want to extract the service provider
name so that's why we have to create a variable and it will be service pro and then we have to
call our phone numbers dot parse and then here we have to pass our number so now we have to print
the service provider name so that's wireless print and here first we have to call our carrier dot
name for number and then here we have to give the variable name which we have created here
and then we have to give a language name and it will be en that's it now if i run this again
here you can see that country is bangladesh and the service provider i am using ruby so after the
country name and the service provider name now i want to see the location of this phone number
in a google map so for doing this let's close this one first we have to install a package
from python so that's why let's go to our terminal again and here we have to again write pip install
and here we have to give the package name and it will be open cage that's it and type enter
now in a few moments open cage will be installed in your computer
and guys here you can see that we have successfully installed our open cage so
now close this one so after installing the open cage we have to now import the open
cage in our project file so that's why let's go to the top here and here we have to import
open cage that's it and after importing our open case now we have to import
some packages from our open cage so that's why from open cage dot jio coder
import and here we have to import open cage jio code so after doing this we have to do
another thing we have to open our browser and then you have to visit opencagedata.com
and from this website you have to create a free account after creating a free account
they will give you a dashboard and inside your dashboard you will find your api keys
so select the api keys here you can see that i have my api keys now i have to copy this
key and let's go to our text editor and here we have to create a variable and it will be key and
then we have to paste the api key that's it now let's create a variable and it will be geocoder
and then let's call our open cage jio code and here we have to pass our key and then let's
take another variable and it will be query and it will be a string and here inside our this string
we have to pass our location and then we have to take another variable and it will be results
again call our geocoder dot jio code
and then here we have to pass our string formatted query that's it and now let's print this and
see what we are going to find so here we have to pass results and if i now run this
program and guys here you can see that we have a latitude and a longitude
now using these two values we are going to find the location from
our google map now let's close this one comment out this one let's take our let
and here it will be results and i am going to take our first value so that's why it will be 0
and here we are taking a geometry and the value we are taking is the latitude
now simply copy this one and then paste it here we are taking the longitude also like this one
so that's why it will be now copy this and then paste it here that's it now let's print
our latitude and longitude now let's run the program
so guys here you can see that we have a key error here it will be actually lng
not lag now copy this lng and then paste it here and here also now let's run the program
and here you can see that we have our latitude and our longitude
so after getting our these values now we have to install another package so for installing
another package let's go to our terminal and here we have to write pip install folio
now in a few moments this package will be also installed in your computer
and guys here you can see that we have successfully installed our package
now after installing we have to import the package so that's why we have to write here input
volume that's it so after inputting our folium now we have to create a variable and it will be my map
and here we have to call our folium and here inside our folium we have a function which is map
and here we have to give our location and the location equal to will be our
latitude and our longitude and here we have to add zoom start
and it will be 9 that's it now let's arrange the map so for doing this we have to call our folium
and then we have to take our marker function and here we have to give our latitude and the
longitude and then i will call our pop-up and this pop-up will indicate our location and i add to our
map which is my map that's it so after this one now i have to save the map like any other files
so for doing this we have to call our my map dot save because i'm going to save this map inside my
folder so that's why save and here we have to give a name for this file and it will be my location
now remember one thing the file name extension will be a html
it means this is going to be a html file so that's why we have to write html
so if i run this program we will have a file which is my location.html
and this file will be saved in our project folder here so now let's run the program
and i guess here you can see that our execution was successful
and here you can see that i have a file name which is my location.html
so now let's open the file and here you can see that it is a html file
now here you can see that we have some browsers here it means we have to select a browser and
this html file will be shown in that browser
so i'm using chrome so that's why i will select the chrome
and guys here you can see that we have a map here and here you can see that this is the location
so this is the location of that phone number and here you can see that we have successfully tracked
that phone number using a map and i hope this python project was helpful for you and also i
hope you enjoyed this tutorial and if you really do then please please subscribe like this video
and press the bell icon for the future videos and if you guys have any question about this
video please let me know in my comment section that's it guys let's see you in our next tutorial