A Python package to fetch public and local IP information, and to make HTTP requests with proxy support, including HTML content fetching via requests or Selenium.
Project description
iplookupx
iplookupx is a versatile Python package that provides three main capabilities:
- Retrieve your public and local IP addresses, including IPv4 and IPv6, along with detailed geolocation and ISP metadata.
- Make HTTP requests and retrieve HTML content using proxies, supporting both standard requests and Selenium-based browsing for dynamic content fetching.
- Check whether a given proxy is working by making a simple HTTP request to a test URL.
Features
-
IP Lookup:
- Fetch public IPv4 and IPv6 addresses from multiple reliable services.
- Retrieve local network IP addresses.
- Obtain rich metadata (country, city, ISP, ASN, etc.) for your public IPv4 using a free external API.
-
Proxy HTTP Requests:
- Make HTTP requests via proxy servers.
- Supports Selenium-based requests for sites requiring JavaScript rendering.
- Easily integrate proxy usage for both simple and dynamic web scraping.
-
Proxy Health Check:
- Verify if a proxy is working by sending a simple HTTP request to a test URL.
- Helps ensure proxy reliability before use.
Installation
pip install iplookupx
# ================================================================
from iplookupx import ip_verifier
# Checks whether the given proxy is working by making a simple HTTP request to a test URL.
# Define your proxy settings (this is just an example, use a valid proxy IP and port)
proxy = {
"http": "http://proxy_ip:port",
"https": "https://proxy_ip:port"
}
proxy = {
"http": "http://10.10.1.10:3128",
"https": "https://10.10.1.10:1080"
}
# Call the function with the proxy
is_working = ip_verifier(proxy)
# Print the result
if is_working:
print("The proxy is working!")
else:
print("The proxy is not working.")
# Define custom headers
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'Accept': 'application/json'
}
# Call the function with custom headers
is_working = ip_verifier(proxy, headers=headers)
# Print the result
if is_working:
print("The proxy is working!")
else:
print("The proxy is not working.")
# Call the function with a custom timeout of 10 seconds
is_working = ip_verifier(proxy, timeout=10)
# Print the result
if is_working:
print("The proxy is working!")
else:
print("The proxy is not working.")
# Call the function with SSL verification disabled
is_working = ip_verifier(proxy, verify=False)
# Print the result
if is_working:
print("The proxy is working!")
else:
print("The proxy is not working.")
# Without Proxy (Direct Request for Public IP)
ip_verifier(proxy=None)
from iplookupx import ip_info
# To fetches IP details from IP address
ip_info(ip_address = "8.8.8.8")
{
'query': '8.8.8.8',
'status': 'success',
'address': {
'continent': '',
'continent_code': '',
'country': 'United States',
'country_code': 'US',
'region': 'VA',
'region_name': 'Virginia',
'city': 'Ashburn',
'district': '',
'postal': '20149',
'latitude': 39.03,
'longitude': -77.5
},
'timezone': 'America/New_York',
'offset': '',
'currency': '',
'service_provider': {
'isp': 'Google LLC',
'organization': 'Google Public DNS',
'as_numer': 'AS15169 Google LLC',
'as_name': '',
'mobile': '',
'proxy': '',
'hosting': ''
}
}
from iplookupx import my_ip_info
ip_data = my_ip_info()
print("===== Public IP Information =====")
print(f"IPv4: {ip_data['public_ip']['ipv4']}")
print(f"IPv6: {ip_data['public_ip']['ipv6']}")
print("Metadata (Geolocation, ISP, etc.):")
for key, value in ip_data["public_ip"]["info"].items():
print(f" {key.capitalize()}: {value}")
print("\n===== Local IP Addresses =====")
print(f"Local IPv4: {ip_data['local_ip']['IPv4']}")
print(f"Local IPv6: {ip_data['local_ip']['IPv6']}")
===== Public IP Information =====
IPv4: 203.0.113.45
IPv6: 2001:0db8:85a3::8a2e:0370:7334
Metadata (Geolocation, ISP, etc.):
Country: United States
City: San Francisco
Org: Example ISP
As: AS12345 ExampleNet
===== Local IP Addresses =====
Local IPv4: 192.168.1.100
Local IPv6: fe80::1c2d:3eff:fe4e:88a
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iplookupx-0.1.2.tar.gz
(6.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iplookupx-0.1.2.tar.gz.
File metadata
- Download URL: iplookupx-0.1.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9420d0fff8c3db27596389b8daa855b31eab40997cf447ffe4eff24972d09de
|
|
| MD5 |
b8ff24340267ba26cf5f7879e2c08df9
|
|
| BLAKE2b-256 |
d1dd8ad1d2d87c304043fb9f81494f2a414683da0522736dbc02fe0f6bf3e735
|
File details
Details for the file iplookupx-0.1.2-py3-none-any.whl.
File metadata
- Download URL: iplookupx-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8705c574656e69f2c470687615408a4a772ac4c33d9746c6af3c3f4835fc3acf
|
|
| MD5 |
db657ee631ddd8383ee3fcc4ab617098
|
|
| BLAKE2b-256 |
995d847de93113edd73d31cb66cef36f83e9dc6d289736a18dd6f1cabeaf33f8
|