March 28, 2023

Information Gathering with IPSTACK a Free Geolocalization API

This is another simple script with python 3.8 for information gathering. I used the free version of the IPSTACK API to make this script. I did not provide an API key for this tutorial. If you want to try it yourself, you need to sign up on their website. It is completely free, but you are limited to only ten thousand requests a month.

Also, I added another simple feature at the end of the script. It will use the longitude and latitude variables from the script to open Google Map on your default web browser. Even though, Google Map has their own API. I won’t use it for now, because the script runs on the command line, or terminal for the Linux users.

To run this script, you will need a valid IP Address and your free API key.


Name of the script:

import requests, json, time, os
import webbrowser
url = ""
ip = "" # IP Address
middleV = "?access_key="
apiKey = "" #Insert your API key you get from
cUrl = url + ip + middleV + apiKey
#Start the request 
session = requests.session()
ipstack = session.get(cUrl).json()
dictx = {
# for loop to print the dictionary data or variable 
for x, y in dictx.items():
    print(x,":", y)
gMap = "" + str(ipstack['latitude']) + "," + str(ipstack['longitude']) #open google map on your default webbrowser