There are several APIs available that can provide IP details. One of the popular APIs is the 'ipinfo.io' API. Here is an example of how to use this API in Python:

import requests

# IP address to get details for
ip_address = '8.8.8.8'

# Make API request
response = requests.get(f'https://ipinfo.io/{ip_address}?token=<YOUR_API_TOKEN>')

# Parse JSON response
data = response.json()

# Print IP details
print(f'IP Address: {data['ip']}')
print(f'City: {data['city']}')
print(f'Region: {data['region']}')
print(f'Country: {data['country']}')
print(f'ISP: {data['org']}')

Note: Replace <YOUR_API_TOKEN> with your actual API token from the ipinfo.io website.

How to Get IP Details Using Python and the ipinfo.io API

原文地址: https://www.cveoy.top/t/topic/mz1w 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录