IP Address Geolocation with Python (ipify.org, IP-API.com)

API Websites:

Code:

This code will get your external IP Address, and then use that to find geographic information.

import requests

ip_address = requests.get('http://api.ipify.org').text

print(ip_address)

response = requests.get(f'http://ip-api.com/json/{ip_address}').json()

print(response)

print(response['city'])

Be the first to comment

Leave a Reply