Skip to main content

Get IP and location from URL| Get Location and IP of any link using python #python #IP #Location| python for beginner

Hello reader's , 

Today we are going to see that how can we find IP and Location of any URL.

Get IP and location from URL.

In this blog you are going to see that how you can find the IP and location of any URL(Uniform Resource Locator). To perform this activity you must know about the basics of python programming language because we are going to use python programming language. 

First of all you have to install python on your laptop or desktop. For installing follow these steps.

 To install python perform the following steps :-

1) Go to - https://www.python.org/downloads/ 

2) click "Download" .

3) Download the any latest python version from the given website .

4) When download complete just open your file explorer and double click on downloaded python file and install the python in which directory you want. 

5) After the successful installation just double click on python icon on desktop to open python IDE. 


Python logo


After the successful installation of python on your machine you need to install a IDE which supports python i am using vs code you may use other IDE like - pycharm. 

To install VS code(Visual Studio code) follow these steps :- 

1) Go to - https://code.visualstudio.com/download 

2) Select your system which you are using, it is MacOS , Linux or Windows and download according to your system architecture. 

3) Once download is complete run the installer file (.exe file). 

4) Agree the terms and condition and click on next and then select the directory where to store the files of VS code.

5) After one or two permission VS code will starts installing on your system. 

6) Go to the desktop icon and double click it to open. 


VS code logo 

How to install Pycharm?

To install Pycharm follow these steps :- 

1) Go to - https://www.jetbrains.com/pycharm/download/#section=windows 

2) Select community and start downloading.

3) Once the downloading is completed click on the installer file(.exe file).

4) Now agree the terms and conditions and go on.

5) Select the directory where Pycharm can store their files and updates.

6) After the successful installation go to desktop and double click on pycharm icon to open. 


pycharm logo



 For performing this activity i am using vs code you can use pycharm or even python IDE too. 

There is one module you need to install "pip install ip2geotools",

To install this module open cmd(command prompt) and type pip install ip2geotools

 After successful installation of module type the code and see the output in terminal window.

code :- 

import socket

from ip2geotools.databases.noncommercial import DbIpCity


url = input("Enter the URL:")

IP = socket.gethostbyname(url)

response = DbIpCity.get(IP, api_key='free')

print("IP: ",IP)

print("City:", response.city)

print("Region: ", response.region)

print("Country: ", response.country)






Comments

Popular posts from this blog

Android 13 features| Android 13 updates| Material You design| language Customizable| Android themes Privacy and security controls in Android 13| App Hibernation in Android 13| Adaptive Charging in Android 13| Android 13 release date| Android Beta Program| Latest Android version

 Android 13: What's New and Exciting? Android 13, codenamed Tiramisu, is the latest version of Google's mobile operating system that is expected to launch in late 2023. Android 13 promises to bring a host of new features and improvements to enhance the user experience, security, and performance of Android devices. In this blog post, we will take a look at some of the most anticipated features of Android 13 and how they will benefit users and developers alike. One of the biggest changes in Android 13 is the introduction of Material You, a new design language that adapts to the user's preferences, mood, and context. Material You allows users to customize their device's theme, colors, fonts, icons, and shapes according to their personal style and taste. Material You also changes dynamically based on the time of day, the wallpaper, the app, and the device mode. For example, if the user switches to dark mode, the system will automatically adjust the colors and brightness to ...

Define a function that computes the length of a given list or string| Python for beginner

 Python is a popular programming language that is widely used by developers and data scientists. One of the fundamental concepts in Python is functions, which are self-contained blocks of code that perform a specific task. In this blog post, we will discuss how to define a function that computes the length of a given list or string using Python. What is a Function? A function is a block of code that performs a specific task. Functions are self-contained and can be called from anywhere in a program. Functions are an essential part of Python and are used extensively in programming. Defining a Function in Python In Python, functions are defined using the 'def' keyword, followed by the name of the function, and a set of parentheses. The body of the function is indented and contains the code that performs the task. Here is an example of a function that computes the length of a given list: def compute_length(list):     length = 0     for item in list:     ...

Define a procedure histogram() that takes a list of integers and prints a histogram to the screen| Histogram procedure| printing histogram| Python histogram function| Python programming

  How to Visualize Data with Python: Defining a Procedure Histogram() When it comes to analyzing data, visualization is key. Being able to see the patterns and trends in your data can make all the difference in understanding it. Luckily, Python has a built-in function for creating histograms, which is a powerful tool for visualizing data. In this blog post, we'll define a procedure called histogram() that takes a list of integers and prints a histogram to the screen. Before we get into the nitty-gritty of the code, let's briefly discuss what a histogram is and why it's useful. A histogram is a graphical representation of a frequency distribution, which is essentially a way to show how often certain values occur in a dataset. It's a great way to get a quick sense of the shape of your data, including its range, distribution, and outliers. Now, let's dive into the code. Here's how you can define a procedure histogram() in Python: def histogram(int_list):     for i ...